Repository navigation
Add timeout and killSignal options to child_process spawn() and fork() #27639
Description
Activity
maxBufferdoesn't make sense forspawn()/fork()because nothing is being buffered internally (outside of normal stream behavior).Yes you're correct, it does not make sense. I changed the original post to only target
timeoutandkillSignal.- changed the title
[-]Make `child_process` options more consistent between the different methods[/-][+]Add `timeout` and `killSignal` options to `child_process` `spawn()` and `fork()`[/+]on May 10, 2019 - addedchild_processIssues and PRs related to the child_process subsystem.Issues and PRs related to the child_process subsystem.feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.
on May 10, 2019 spawn and fork are thought to be used mostly for longer running processes, not one shots like exec and spawnSync, which is why I suppose the options were not implemented.
However, I can see why that assumption isn't necessarily true, and consistency is useful.
Do you have time and interest in contributing this feature?
Reacted by ehmickyHi @sam-github, thanks! Yes I can submit a PR.
Reacted by Sindre Sorhus@ehmicky note that the feature will need tests, which will take more time than the implementation code/docs itself. Just so you know what you are getting into :-)
Yes I was expecting that :)
I'll take a shot at this.
Reacted by Ruy Adorno- added a commit that references this issue
on Mar 19, 2021 - added a commit that references this issue
on Mar 24, 2021 - added a commit that references this issue
on Aug 8, 2021 - added a commit that references this issue
on Sep 1, 2021
Is your feature request related to a problem? Please describe.
The
timeoutandkillSignaloptions are available inexecFile[Sync](),exec[Sync](),spawnSync()but not inspawn()norfork().Those methods could be useful for
spawn()andfork()too. For example, projects likeexeca(by @sindresorhus) use userland code to bring those options tospawn().Describe the solution you'd like
Add those options to
spawn()andfork().