Repository navigation
child_process: add subprocess.timedOut - #66639
Open
marcopiraccini wants to merge 1 commit into
Open
marcopiraccini wants to merge 1 commit into
marcopiraccini wants to merge 1 commit into
Conversation
When the timeout option of spawn(), exec(), execFile() or fork() expires, the child is sent the kill signal and exits with that signal. Nothing told the caller that the timeout was the reason. Set subprocess.timedOut to true when the kill signal is sent because of the timeout, and add the same flag to the error passed to the exec() and execFile() callback. Fixes: nodejs#51561 Refs: nodejs#51608 Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
marcopiraccini
marked this pull request as ready for review
October 10, 2026 09:25
ShogunPanda
approved these changes
Oct 10, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66639 +/- ##
==========================================
- Coverage 92.78% 90.43% -2.35%
==========================================
Files 422 791 +369
Lines 193692 276601 +82909
Branches 29881 53116 +23235
==========================================
+ Hits 179718 250148 +70430
- Misses 13645 16872 +3227
- Partials 329 9581 +9252
🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When a child process receives its kill signal because
timeoutexpired, callers cannot distinguish that from a signal sent for another reason.Add
subprocess.timedOutforspawn(),exec(),execFile()andfork(), anderror.timedOuton errors returned byexec()andexecFile(). The flag becomestrueonly when the timeout successfully sends the signal; it does not guarantee that the process has terminated.This revisits #51608, which proposed the same property for #51561 but closed without landing. That review requested documentation and noted failing CI. This PR includes API documentation and regression tests for timeout expiry, normal exit, manual termination, non-timeout errors, and descendants keeping stdio open after the child exits.
Fixes: #51561
Refs: #51608