utils_test.go 784 B

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