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: cleanup AbortSignal code duplication #37823

Conversation

Linkgoron
Copy link
Member

@Linkgoron Linkgoron commented Mar 19, 2021

This PR cleans-up AbortSignal code duplication between fork/exec and spawn (which seem to share the same essential implementation). Removed spawnWithSignal, and all logic is now in spawn.

This PR does have two behaviour changes:

  • Some timing changes for fork/execFile, where before for fork/execFile an abort caused an abort in next-tick, while now it'll call abort in the same tick (a pre-aborted signal still aborts in next-tick as before). The behaviour for spawn is unchanged.
  • I've moved signal registration to after child.spawn() is called, so that if child.spawn() throws, the signal won't keep a reference to the "bad" child-process.

cleanup AbortSignal child_process code duplication
@nodejs-github-bot nodejs-github-bot added child_process Issues and PRs related to the child_process subsystem. needs-ci PRs that need a full CI run. labels Mar 19, 2021
@nodejs-github-bot
Copy link
Collaborator

@Linkgoron Linkgoron changed the title child_process: cleanup AbortSignal duplication child_process: cleanup AbortSignal code duplication Mar 20, 2021
lib/child_process.js Outdated Show resolved Hide resolved
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Mar 20, 2021

@aduh95 aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 20, 2021
@jasnell
Copy link
Member

jasnell commented Mar 22, 2021

Landed in 6ea652d

@jasnell jasnell closed this Mar 22, 2021
jasnell pushed a commit that referenced this pull request Mar 22, 2021
cleanup AbortSignal child_process code duplication

PR-URL: #37823
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
ruyadorno pushed a commit that referenced this pull request Mar 24, 2021
cleanup AbortSignal child_process code duplication

PR-URL: #37823
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@ruyadorno ruyadorno mentioned this pull request Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. child_process Issues and PRs related to the child_process subsystem. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants