github.com/robertojrojas/docker@v1.9.1/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 getExitCode(err error) (int, error) { 13 return integration.GetExitCode(err) 14 } 15 16 func processExitCode(err error) (exitCode int) { 17 return integration.ProcessExitCode(err) 18 } 19 20 func isKilled(err error) bool { 21 return integration.IsKilled(err) 22 } 23 24 func runCommandWithOutput(cmd *exec.Cmd) (output string, exitCode int, err error) { 25 return integration.RunCommandWithOutput(cmd) 26 } 27 28 func runCommandWithStdoutStderr(cmd *exec.Cmd) (stdout string, stderr string, exitCode int, err error) { 29 return integration.RunCommandWithStdoutStderr(cmd) 30 } 31 32 func runCommandWithOutputForDuration(cmd *exec.Cmd, duration time.Duration) (output string, exitCode int, timedOut bool, err error) { 33 return integration.RunCommandWithOutputForDuration(cmd, duration) 34 } 35 36 func runCommandWithOutputAndTimeout(cmd *exec.Cmd, timeout time.Duration) (output string, exitCode int, err error) { 37 return integration.RunCommandWithOutputAndTimeout(cmd, timeout) 38 } 39 40 func runCommand(cmd *exec.Cmd) (exitCode int, err error) { 41 return integration.RunCommand(cmd) 42 } 43 44 func runCommandPipelineWithOutput(cmds ...*exec.Cmd) (output string, exitCode int, err error) { 45 return integration.RunCommandPipelineWithOutput(cmds...) 46 } 47 48 func unmarshalJSON(data []byte, result interface{}) error { 49 return integration.UnmarshalJSON(data, result) 50 } 51 52 func convertSliceOfStringsToMap(input []string) map[string]struct{} { 53 return integration.ConvertSliceOfStringsToMap(input) 54 } 55 56 func compareDirectoryEntries(e1 []os.FileInfo, e2 []os.FileInfo) error { 57 return integration.CompareDirectoryEntries(e1, e2) 58 } 59 60 func listTar(f io.Reader) ([]string, error) { 61 return integration.ListTar(f) 62 } 63 64 func randomTmpDirPath(s string, platform string) string { 65 return integration.RandomTmpDirPath(s, platform) 66 } 67 68 func consumeWithSpeed(reader io.Reader, chunkSize int, interval time.Duration, stop chan bool) (n int, err error) { 69 return integration.ConsumeWithSpeed(reader, chunkSize, interval, stop) 70 } 71 72 func parseCgroupPaths(procCgroupData string) map[string]string { 73 return integration.ParseCgroupPaths(procCgroupData) 74 } 75 76 func runAtDifferentDate(date time.Time, block func()) { 77 integration.RunAtDifferentDate(date, block) 78 }