-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
When killing the child process, kill all the descendants as well #170
Closed
Commits on Jan 20, 2019
-
When killing the child process, kill all the descendents as well
This is an attempt to fix the problem described by the issue sindresorhus#96. If a child process is killed, the descendents of that child process won't be killed as well. This happens on Linux but not on Windows [^1]. The adopted solution is the "PID range hack" [^2] that uses the `detached` mode for spawning a process and then kills that child process by killing the PID group, using `process.kill(-pid)`, effectively killing all the descendents. *Implementation* - added an internal option `killByPid` as a remained for the spawned child process that it will be `detached` and to kill it by PID - expanded and moved to a separate function the routine to kill the spawned process to `killSpawned` - the `ChildProcess#kill` method of the spawned child process will be replaced by the `killSpawned` routine, to kill by pid if necessary - the `killSpawned` routine signals that the child process has been killed, if it has been killed by the pid I checked and all the tests pass. This implementation also considers the issue sindresorhus#115 and shouldn't interfere with the detached/cleanup fix. [^1]: https://nodejs.org/api/child_process.html#child_process_subprocess_kill_signal [^2]: https://azimi.me/2014/12/31/kill-child_process-node-js.html
Configuration menu - View commit details
-
Copy full SHA for c16cc46 - Browse repository at this point
Copy the full SHA c16cc46View commit details
Commits on Mar 10, 2019
-
Configuration menu - View commit details
-
Copy full SHA for a82d9da - Browse repository at this point
Copy the full SHA a82d9daView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1725e3b - Browse repository at this point
Copy the full SHA 1725e3bView commit details
Commits on Mar 21, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 2b0cecd - Browse repository at this point
Copy the full SHA 2b0cecdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6aa5254 - Browse repository at this point
Copy the full SHA 6aa5254View commit details -
Configuration menu - View commit details
-
Copy full SHA for c73e754 - Browse repository at this point
Copy the full SHA c73e754View commit details -
Configuration menu - View commit details
-
Copy full SHA for d116af8 - Browse repository at this point
Copy the full SHA d116af8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 278fa7d - Browse repository at this point
Copy the full SHA 278fa7dView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.