utils.go 732 B

123456789101112131415161718192021222324252627282930
  1. package main
  2. import (
  3. "github.com/docker/docker/pkg/integration/cmd"
  4. "os/exec"
  5. )
  6. func getPrefixAndSlashFromDaemonPlatform() (prefix, slash string) {
  7. if daemonPlatform == "windows" {
  8. return "c:", `\`
  9. }
  10. return "", "/"
  11. }
  12. // TODO: update code to call cmd.RunCmd directly, and remove this function
  13. func runCommandWithOutput(execCmd *exec.Cmd) (string, int, error) {
  14. result := cmd.RunCmd(transformCmd(execCmd))
  15. return result.Combined(), result.ExitCode, result.Error
  16. }
  17. // Temporary shim for migrating commands to the new function
  18. func transformCmd(execCmd *exec.Cmd) cmd.Cmd {
  19. return cmd.Cmd{
  20. Command: execCmd.Args,
  21. Env: execCmd.Env,
  22. Dir: execCmd.Dir,
  23. Stdin: execCmd.Stdin,
  24. Stdout: execCmd.Stdout,
  25. }
  26. }