-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added proper SIGTERM/SIGKILL handling for sub-processes (#286)
Fixes #284. The idea is to introduce a new flag to both `os.proc.call` and `os.ProcGroup.call`, as well as backing implementations in `os.ProcessLike`. The flag, `timeoutGracePeriod`, allows for a configurable use of `SIGKILL`, which forcibly kills a process, after the issue of a `SIGTERM`, which allows a process to clean up. The values for the flag have the following behaviours: |value | behaviour| |------|-----------| | -1 | When `timeout != -1`, only a `SIGTERM` will be issued, requiring the child process to gracefully terminate. | | 0 | When `timeout != -1`, only a `SIGKILL` is issued, demanding the child terminate immediately with no chance of graceful cleanup. | | n > 0 | `timeout != -1`, first issue a `SIGTERM` and then wait for a further `n` milliseconds before issuing a `SIGKILL`, this provides a reasonable timeframe for process cleanup, but accounts for misbehaving processes. | For now, the default has been set to `timeoutGracePeriod = 1000`.
- Loading branch information
Showing
3 changed files
with
172 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters