File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -280,10 +280,12 @@ func enableAutoRebuild() bool {
280280}
281281
282282func runCommandLocal (cmd []string ) (bytes.Buffer , string , error ) {
283+ ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Second )
284+ defer cancel ()
283285 var stdout , stderr bytes.Buffer
284286 var err error
285287 log .Debugf ("command to execute is [%s]" , strings .Join (cmd , " " ))
286- cmd_ := exec .Command ( cmd [0 ], cmd [1 :]... )
288+ cmd_ := exec .CommandContext ( ctx , cmd [0 ], cmd [1 :]... )
287289 cmd_ .Stdout = & stdout
288290 cmd_ .Stderr = & stderr
289291 err = cmd_ .Run ()
@@ -437,6 +439,7 @@ func disableMyRaft() error {
437439 raftDisableCommand := []string {"bash" , "-c" , raftDisableCommand }
438440 if _ , stdErr , err := runCommandLocal (raftDisableCommand ); err != nil {
439441 log .Errorf ("failed to disable my raft: %s" , stdErr )
442+ return err
440443 }
441444 return nil
442445}
You can’t perform that action at this time.
0 commit comments