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(signal handling for child process) #4290

Merged
merged 1 commit into from
Mar 23, 2023
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
11 changes: 9 additions & 2 deletions cli/internal/run/real_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,15 @@ func RealRun(

for _, err := range errs {
if errors.As(err, &exitCodeErr) {
if exitCodeErr.ExitCode > exitCode {
exitCode = exitCodeErr.ExitCode
// If a process gets killed via a signal, Go reports it's exit code as -1.
// We take the absolute value of the exit code so we don't select '0' as
// the greatest exit code.
childExit := exitCodeErr.ExitCode
if childExit < 0 {
childExit = -childExit
}
if childExit > exitCode {
exitCode = childExit
}
} else if exitCode == 0 {
// We hit some error, it shouldn't be exit code 0
Expand Down