From 137a7aad304e7f7c47f46b57f896bfc03852d384 Mon Sep 17 00:00:00 2001 From: Thom Carlin Date: Tue, 29 Oct 2024 12:04:08 -0400 Subject: [PATCH] Fix command error checking in 2 places (#1199) --- pkg/workceptor/command.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/workceptor/command.go b/pkg/workceptor/command.go index efa6fcd6d..0db29f6c1 100644 --- a/pkg/workceptor/command.go +++ b/pkg/workceptor/command.go @@ -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 @@ -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) + } } }