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

Add timeout and killSignal options to child_process spawn() and fork() #27639

Closed
ehmicky opened this issue May 10, 2019 · 7 comments · Fixed by #37256
Closed

Add timeout and killSignal options to child_process spawn() and fork() #27639

ehmicky opened this issue May 10, 2019 · 7 comments · Fixed by #37256
Labels
child_process Issues and PRs related to the child_process subsystem. feature request Issues that request new features to be added to Node.js.

Comments

@ehmicky
Copy link

ehmicky commented May 10, 2019

Is your feature request related to a problem? Please describe.
The timeout and killSignal options are available in execFile[Sync](), exec[Sync](), spawnSync() but not in spawn() nor fork().

Those methods could be useful for spawn() and fork() too. For example, projects like execa (by @sindresorhus) use userland code to bring those options to spawn().

Describe the solution you'd like
Add those options to spawn() and fork().

@mscdex
Copy link
Contributor

mscdex commented May 10, 2019

maxBuffer doesn't make sense for spawn()/fork() because nothing is being buffered internally (outside of normal stream behavior).

@ehmicky
Copy link
Author

ehmicky commented May 10, 2019

Yes you're correct, it does not make sense. I changed the original post to only target timeout and killSignal.

@ehmicky ehmicky changed the title Make child_process options more consistent between the different methods Add timeout and killSignal options to child_process spawn() and fork() May 10, 2019
@sam-github sam-github added child_process Issues and PRs related to the child_process subsystem. feature request Issues that request new features to be added to Node.js. labels May 10, 2019
@sam-github
Copy link
Contributor

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?

@ehmicky
Copy link
Author

ehmicky commented May 10, 2019

Hi @sam-github, thanks! Yes I can submit a PR.

@sam-github
Copy link
Contributor

@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 :-)

@ehmicky
Copy link
Author

ehmicky commented May 10, 2019

Yes I was expecting that :)

@Linkgoron
Copy link
Member

I'll take a shot at this.

Linkgoron pushed a commit to Linkgoron/node that referenced this issue Feb 6, 2021
Add support for timeout and killSignal to spawn and fork.

Fixes: nodejs#27639
Linkgoron pushed a commit to Linkgoron/node that referenced this issue Feb 6, 2021
Add support for timeout and killSignal to spawn and fork.

Fixes: nodejs#27639
Linkgoron pushed a commit to Linkgoron/node that referenced this issue Feb 7, 2021
Add support for timeout and killSignal to spawn and fork.

Fixes: nodejs#27639
Linkgoron pushed a commit to Linkgoron/node that referenced this issue Feb 27, 2021
Add support for timeout to spawn and fork.

Fixes: nodejs#27639
Linkgoron pushed a commit to Linkgoron/node that referenced this issue Feb 27, 2021
Add support for timeout to spawn and fork.

Fixes: nodejs#27639
Linkgoron pushed a commit to Linkgoron/node that referenced this issue Feb 27, 2021
Add support for timeout to spawn and fork.

Fixes: nodejs#27639
Linkgoron pushed a commit to Linkgoron/node that referenced this issue Feb 28, 2021
Add support for timeout to spawn and fork.

Fixes: nodejs#27639
Linkgoron pushed a commit to Linkgoron/node that referenced this issue Mar 3, 2021
Add support for timeout to spawn and fork.

Fixes: nodejs#27639
Linkgoron pushed a commit to Linkgoron/node that referenced this issue Mar 5, 2021
Add support for timeout to spawn and fork.

Fixes: nodejs#27639
@aduh95 aduh95 closed this as completed in d8fb5c2 Mar 19, 2021
ruyadorno pushed a commit that referenced this issue Mar 24, 2021
Add support for timeout to spawn and fork.

Fixes: #27639

PR-URL: #37256
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
targos pushed a commit to targos/node that referenced this issue Aug 8, 2021
Add support for timeout to spawn and fork.

Fixes: nodejs#27639

PR-URL: nodejs#37256
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
targos pushed a commit that referenced this issue Sep 1, 2021
Add support for timeout to spawn and fork.

Fixes: #27639

PR-URL: #37256
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
child_process Issues and PRs related to the child_process subsystem. feature request Issues that request new features to be added to Node.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants