@@ -11,24 +11,16 @@ import (
1111 utils "github.com/flant/shell-operator/pkg/utils/labels"
1212)
1313
14- var ExecutorLock = & sync.RWMutex {}
15-
16- // This family of methods use ExecutorLock to not be interfered by zombie reaper.
17-
1814func Run (cmd * exec.Cmd ) error {
19- ExecutorLock .RLock ()
20- defer ExecutorLock .RUnlock ()
21-
2215 // TODO context: hook name, hook phase, hook binding
16+ // TODO observability
2317 log .Debugf ("Executing command '%s' in '%s' dir" , strings .Join (cmd .Args , " " ), cmd .Dir )
2418
2519 return cmd .Run ()
2620}
2721
2822func RunAndLogLines (cmd * exec.Cmd , logLabels map [string ]string ) error {
29- ExecutorLock .RLock ()
30- defer ExecutorLock .RUnlock ()
31-
23+ // TODO observability
3224 logEntry := log .WithFields (utils .LabelsToLogFields (logLabels ))
3325 stdoutLogEntry := logEntry .WithField ("output" , "stdout" )
3426 stderrLogEntry := logEntry .WithField ("output" , "stderr" )
@@ -83,9 +75,9 @@ func RunAndLogLines(cmd *exec.Cmd, logLabels map[string]string) error {
8375}
8476
8577func 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 )
8981 output , err = cmd .Output ()
9082 return
9183}
0 commit comments