Skip to content

Commit

Permalink
Fix command error checking in 2 places (#1199)
Browse files Browse the repository at this point in the history
  • Loading branch information
thom-at-redhat authored Oct 29, 2024
1 parent b89bdac commit 137a7aa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/workceptor/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ func termThenKill(cmd *exec.Cmd, doneChan chan bool) {
if cmd.Process == nil {
return
}
_ = cmd.Process.Signal(os.Interrupt)
pserr := cmd.Process.Signal(os.Interrupt)
if pserr != nil {
MainInstance.nc.GetLogger().Warning("Error processing Interrupt Signal: %+v", pserr)
}
select {
case <-doneChan:
return
Expand All @@ -79,7 +82,10 @@ func termThenKill(cmd *exec.Cmd, doneChan chan bool) {
}
if cmd.Process != nil {
MainInstance.nc.GetLogger().Info("sending SIGKILL to pid %d", cmd.Process.Pid)
_ = cmd.Process.Kill()
pkerr := cmd.Process.Kill()
if pkerr != nil {
MainInstance.nc.GetLogger().Warning("Error killing pid %d: %+v", cmd.Process.Pid, pkerr)
}
}
}

Expand Down

0 comments on commit 137a7aa

Please sign in to comment.