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

child_process: add AbortSignal support #36308

Closed

Conversation

benjamingr
Copy link
Member

@benjamingr benjamingr commented Nov 28, 2020

Support AbortSignal in child_process.execFile.

Bikeshedding:

  • I know everywhere else it's called signal and that it's the web platform guidance - but I think we might want to deviate here and call the parameter abortSignal to prevent confusion with OS signals and killSignal. WDYT?

I will follow up with support in the other child_process APIs like fork and spawn.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the child_process Issues and PRs related to the child_process subsystem. label Nov 28, 2020
@benjamingr benjamingr marked this pull request as ready for review November 29, 2020 14:38
@benjamingr benjamingr added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 29, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 29, 2020
@nodejs-github-bot
Copy link
Collaborator

@Trott
Copy link
Member

Trott commented Dec 1, 2020

@nodejs/child_process

@@ -330,6 +334,21 @@ getVersion();
function. Any input containing shell metacharacters may be used to trigger
arbitrary command execution.**

If the `AbortSignal` option is enabled, calling `.abort()` on the corresponding
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's called signal above, right? (I guess this is what your bikeshedding note is about.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I think this is just a mistake on my part unrelated to the bikeshedding?

Comment on lines 341 to 340
For example:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For example:

@Trott Trott added the semver-minor PRs that contain new features and should be released in the next minor version. label Dec 1, 2020
@addaleax
Copy link
Member

addaleax commented Dec 1, 2020

I, for one, would love more consistency between the different child_process.* methods, so if we could add this to all of the async ones at once or not at all, I think that might be nice (except maybe spawn because that’s “more async” in a way, but then again, why not also spawn? … 🙂 )

@benjamingr
Copy link
Member Author

@addaleax I intend to add them to all of the APIs - I just find large'ish PRs are harder to land in Node and get meaningful reviews so I made smaller ones. The idea is to add this to fork and spawn later.

If you feel strongly that it should happen in the same PR I am happy to push the commit that adds it to fork and span here if you will review it (Perhaps I already have a branch with a commit on top of this one that adds it 😅 ).

Otherwise I would rather land this and then land the spawn/fork changes in a follow up PR.

@benjamingr benjamingr added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Dec 1, 2020
@benjamingr benjamingr added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 5, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 5, 2020
@nodejs-github-bot
Copy link
Collaborator

benjamingr added a commit that referenced this pull request Dec 6, 2020
PR-URL: #36308
Reviewed-By: Rich Trott <rtrott@gmail.com>
@benjamingr
Copy link
Member Author

Landed in 20de5f7 will follow up shortly with form and spawn

@benjamingr benjamingr closed this Dec 6, 2020
@benjamingr benjamingr deleted the child-process-abort-signal branch December 6, 2020 10:24
@benjamingr
Copy link
Member Author

I think somehow ncu pushed something that shouldn't have been here - investigating

@benjamingr
Copy link
Member Author

It looks like indeed this landed after last CI since I squashed, somehow this change that wasn't in the original (and commits) and didn't go through CI got in.

This is probably a PBKAC on my part and I landed the squashed commit with NCU

@benjamingr benjamingr mentioned this pull request Dec 6, 2020
4 tasks
danielleadams pushed a commit that referenced this pull request Dec 7, 2020
PR-URL: #36308
Reviewed-By: Rich Trott <rtrott@gmail.com>
@danielleadams danielleadams mentioned this pull request Dec 7, 2020
danielleadams added a commit that referenced this pull request Dec 7, 2020
PR-URL: #36435

Notable changes:

* child_processes:
  * add AbortSignal support (Benjamin Gruenbaum) (#36308)
* deps:
  * update ICU to 68.1 (Michaël Zasso) (#36187)
* events:
  * support signal in EventTarget (Benjamin Gruenbaum) (#36258)
  * graduate Event, EventTarget, AbortController (James M Snell) (#35949)
* http:
  * enable call chaining with setHeader() (pooja d.p) (#35924)
* module:
  * add isPreloading indicator (James M Snell) (#36263)
* stream:
  * support abort signal (Benjamin Gruenbaum) (#36061)
  * add FileHandle support to Read/WriteStream (Momtchil Momtchev) (#35922)
* worker:
  * add experimental BroadcastChannel (James M Snell) (#36271)
cjihrig pushed a commit to cjihrig/node that referenced this pull request Dec 8, 2020
PR-URL: nodejs#36308
Reviewed-By: Rich Trott <rtrott@gmail.com>
danielleadams added a commit that referenced this pull request Dec 9, 2020
PR-URL: #36435

Notable changes:

* child_processes:
  * add AbortSignal support (Benjamin Gruenbaum) (#36308)
* deps:
  * update ICU to 68.1 (Michaël Zasso) (#36187)
* events:
  * support signal in EventTarget (Benjamin Gruenbaum) (#36258)
  * graduate Event, EventTarget, AbortController (James M Snell) (#35949)
* http:
  * enable call chaining with setHeader() (pooja d.p) (#35924)
* module:
  * add isPreloading indicator (James M Snell) (#36263)
* stream:
  * support abort signal (Benjamin Gruenbaum) (#36061)
  * add FileHandle support to Read/WriteStream (Momtchil Momtchev) (#35922)
* worker:
  * add experimental BroadcastChannel (James M Snell) (#36271)
danielleadams added a commit that referenced this pull request Dec 9, 2020
PR-URL: #36435

Notable changes:

* child_processes:
  * add AbortSignal support (Benjamin Gruenbaum) (#36308)
* deps:
  * update ICU to 68.1 (Michaël Zasso) (#36187)
* events:
  * support signal in EventTarget (Benjamin Gruenbaum) (#36258)
  * graduate Event, EventTarget, AbortController (James M Snell) (#35949)
* http:
  * enable call chaining with setHeader() (pooja d.p) (#35924)
* module:
  * add isPreloading indicator (James M Snell) (#36263)
* stream:
  * support abort signal (Benjamin Gruenbaum) (#36061)
  * add FileHandle support to Read/WriteStream (Momtchil Momtchev) (#35922)
* worker:
  * add experimental BroadcastChannel (James M Snell) (#36271)
targos pushed a commit to targos/node that referenced this pull request Apr 24, 2021
PR-URL: nodejs#36308
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit to targos/node that referenced this pull request Apr 26, 2021
PR-URL: nodejs#36308
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit to targos/node that referenced this pull request Apr 30, 2021
PR-URL: nodejs#36308
Reviewed-By: Rich Trott <rtrott@gmail.com>
targos pushed a commit that referenced this pull request Apr 30, 2021
PR-URL: #36308
Backport-PR-URL: #38386
Reviewed-By: Rich Trott <rtrott@gmail.com>
@danielleadams danielleadams mentioned this pull request May 3, 2021
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. semver-minor PRs that contain new features and should be released in the next minor version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants