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 race condition in signal handling, and error handling #23

Merged
merged 1 commit into from
Dec 5, 2020

Conversation

mpokryva
Copy link
Contributor

@mpokryva mpokryva commented Nov 4, 2019

This PR aims to:

  • Fix a race condition in signal handling
  • Add correct error message handling in case of a termination by signal

Description:

Line 265 causes a race condition when querying the ProcessState (specifically the WaitStatus) in a goroutine, since cmd.Wait() concurrently modifies it. This PR fixes this race condition, and also adds proper error handling when a signal is raised. The current error handling returns a -1 status when the process exits due to a signal:

ExitCode returns the exit code of the exited process, or -1 if the process hasn't exited or was terminated by a signal (https://golang.org/pkg/os/#ProcessState.ExitCode)

@mpokryva mpokryva changed the title Fix race condition in signal handling, and add correct error message … Fix race condition in signal handling, and fix error handling Nov 6, 2019
@mpokryva mpokryva changed the title Fix race condition in signal handling, and fix error handling Fix race condition in signal handling, and error handling Nov 6, 2019
@josegonzalez josegonzalez merged commit 357fd3d into progrium:master Dec 5, 2020
@mpokryva mpokryva deleted the fix-signal-race branch December 6, 2020 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants