We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ab4b855 commit 9264a14Copy full SHA for 9264a14
1 file changed
1.7/client/utils.go
@@ -0,0 +1,28 @@
1
+import (
2
+ "os"
3
+ "os/exec"
4
+ "runtime"
5
+ "strconv"
6
+)
7
+
8
+func Cmd(name string, args ...string) error {
9
+ cmd := exec.Command(name, args...)
10
+ cmd.Stdout = os.Stdout
11
+ cmd.Stderr = os.Stderr
12
+ return cmd.Run()
13
+}
14
15
+func WorkerCount(workerFlag string) int {
16
+ if workerFlag == "default" {
17
+ return runtime.NumCPU()
18
+ }
19
+ count, err := strconv.Atoi(workerFlag)
20
+ if err != nil || count < 0 {
21
+ return 0
22
23
+ return count
24
25
26
+func LogFile(path string) (*os.File, error) {
27
+ return os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
28
0 commit comments