@@ -11,24 +11,16 @@ import (
11
11
utils "github.com/flant/shell-operator/pkg/utils/labels"
12
12
)
13
13
14
- var ExecutorLock = & sync.RWMutex {}
15
-
16
- // This family of methods use ExecutorLock to not be interfered by zombie reaper.
17
-
18
14
func Run (cmd * exec.Cmd ) error {
19
- ExecutorLock .RLock ()
20
- defer ExecutorLock .RUnlock ()
21
-
22
15
// TODO context: hook name, hook phase, hook binding
16
+ // TODO observability
23
17
log .Debugf ("Executing command '%s' in '%s' dir" , strings .Join (cmd .Args , " " ), cmd .Dir )
24
18
25
19
return cmd .Run ()
26
20
}
27
21
28
22
func RunAndLogLines (cmd * exec.Cmd , logLabels map [string ]string ) error {
29
- ExecutorLock .RLock ()
30
- defer ExecutorLock .RUnlock ()
31
-
23
+ // TODO observability
32
24
logEntry := log .WithFields (utils .LabelsToLogFields (logLabels ))
33
25
stdoutLogEntry := logEntry .WithField ("output" , "stdout" )
34
26
stderrLogEntry := logEntry .WithField ("output" , "stderr" )
@@ -83,9 +75,9 @@ func RunAndLogLines(cmd *exec.Cmd, logLabels map[string]string) error {
83
75
}
84
76
85
77
func Output (cmd * exec.Cmd ) (output []byte , err error ) {
86
- ExecutorLock . RLock ()
87
- defer ExecutorLock . RUnlock ()
88
-
78
+ // TODO context: hook name, hook phase, hook binding
79
+ // TODO observability
80
+ log . Debugf ( "Executing command '%s' in '%s' dir" , strings . Join ( cmd . Args , " " ), cmd . Dir )
89
81
output , err = cmd .Output ()
90
82
return
91
83
}
0 commit comments