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