Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix command error checking in 2 places #1199

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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)
}

Check warning on line 76 in pkg/workceptor/command.go

View check run for this annotation

Codecov / codecov/patch

pkg/workceptor/command.go#L73-L76

Added lines #L73 - L76 were not covered by tests
select {
case <-doneChan:
return
Expand All @@ -79,7 +82,10 @@
}
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)
}

Check warning on line 88 in pkg/workceptor/command.go

View check run for this annotation

Codecov / codecov/patch

pkg/workceptor/command.go#L85-L88

Added lines #L85 - L88 were not covered by tests
}
}

Expand Down