github.com/jiasir/docker@v1.3.3-0.20170609024000-252e610103e7/integration-cli/utils_test.go (about)

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