Skip to content

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

Description

@ehmicky

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().

Activity

  1. mscdex commented on May 10, 2019

    @mscdex
    Contributor

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

  2. ehmicky commented on May 10, 2019

    @ehmicky
    Author

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

  3. 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
  4. added
    child_processIssues and PRs related to the child_process subsystem.
    feature requestIssues requesting new Node.js features.
    on May 10, 2019
  5. sam-github commented on May 10, 2019

    @sam-github
    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?

  6. ehmicky commented on May 10, 2019

    @ehmicky
    Author

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

  7. sam-github commented on May 10, 2019

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

  8. ehmicky commented on May 10, 2019

    @ehmicky
    Author

    Yes I was expecting that :)

  9. Linkgoron commented on Feb 6, 2021

    @Linkgoron
    Contributor

    I'll take a shot at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    child_processIssues and PRs related to the child_process subsystem.feature requestIssues requesting new Node.js features.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions