github.com/boynux/docker@v1.11.0-rc4/integration-cli/utils.go (about) 1 package main 2 3 import ( 4 "io" 5 "os" 6 "os/exec" 7 "time" 8 9 "github.com/docker/docker/pkg/integration" 10 ) 11 12 func getPrefixAndSlashFromDaemonPlatform() (prefix, slash string) { 13 if daemonPlatform == "windows" { 14 return "c:", `\` 15 } 16 return "", "/" 17 } 18 19 func getExitCode(err error) (int, error) { 20 return integration.GetExitCode(err) 21 } 22 23 func processExitCode(err error) (exitCode int) { 24 return integration.ProcessExitCode(err) 25 } 26 27 func isKilled(err error) bool { 28 return integration.IsKilled(err) 29 } 30 31 func runCommandWithOutput(cmd *exec.Cmd) (output string, exitCode int, err error) { 32 return integration.RunCommandWithOutput(cmd) 33 } 34 35 func runCommandWithStdoutStderr(cmd *exec.Cmd) (stdout string, stderr string, exitCode int, err error) { 36 return integration.RunCommandWithStdoutStderr(cmd) 37 } 38 39 func runCommandWithOutputForDuration(cmd *exec.Cmd, duration time.Duration) (output string, exitCode int, timedOut bool, err error) { 40 return integration.RunCommandWithOutputForDuration(cmd, duration) 41 } 42 43 func runCommandWithOutputAndTimeout(cmd *exec.Cmd, timeout time.Duration) (output string, exitCode int, err error) { 44 return integration.RunCommandWithOutputAndTimeout(cmd, timeout) 45 } 46 47 func runCommand(cmd *exec.Cmd) (exitCode int, err error) { 48 return integration.RunCommand(cmd) 49 } 50 51 func runCommandPipelineWithOutput(cmds ...*exec.Cmd) (output string, exitCode int, err error) { 52 return integration.RunCommandPipelineWithOutput(cmds...) 53 } 54 55 func unmarshalJSON(data []byte, result interface{}) error { 56 return integration.UnmarshalJSON(data, result) 57 } 58 59 func convertSliceOfStringsToMap(input []string) map[string]struct{} { 60 return integration.ConvertSliceOfStringsToMap(input) 61 } 62 63 func compareDirectoryEntries(e1 []os.FileInfo, e2 []os.FileInfo) error { 64 return integration.CompareDirectoryEntries(e1, e2) 65 } 66 67 func listTar(f io.Reader) ([]string, error) { 68 return integration.ListTar(f) 69 } 70 71 func randomTmpDirPath(s string, platform string) string { 72 return integration.RandomTmpDirPath(s, platform) 73 } 74 75 func consumeWithSpeed(reader io.Reader, chunkSize int, interval time.Duration, stop chan bool) (n int, err error) { 76 return integration.ConsumeWithSpeed(reader, chunkSize, interval, stop) 77 } 78 79 func parseCgroupPaths(procCgroupData string) map[string]string { 80 return integration.ParseCgroupPaths(procCgroupData) 81 } 82 83 func runAtDifferentDate(date time.Time, block func()) { 84 integration.RunAtDifferentDate(date, block) 85 }