Prevents exiting the process on sigint in case of yarn run, fixes #8895. #9114
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prevents exiting the process on SIGINT in case of yarn run.
Current behavior:
When user presses
ctrl+C
yarn exits immediately and shell prompt is shown. If a run script needs some time to cleanup before exit and outputs something to terminal, it pollutes the prompt.New behavior:
yarn
doesn't make any decisions on when to exit, it just waits for the children.Works the same as
npm run
now in that regard.This PR fixes this issue: #8895
Test cases
Test script for this PR: example.js
Regular case
Excerpt from package.json:
Actual behavior with this script:
New behavior with this script:
For reference, npm run behavior:
Using pre/post scripts
Excerpt from package.json:
Actual behavior with this script:
New behavior with this script:
For reference, npm run behavior:
Using pre/post scripts with zero exit code
Excerpt from package.json:
Modify
example.js
and setEXIT_CODE
to0
.Actual behavior:
New behavior:
bash-3.2$ yarn example yarn run v1.23.0-0 $ node example.js tick tick ^CSIGINT from script tick tick tick $ node example.js tick tick ^CSIGINT from script tick tick tick $ node example.js tick tick ^CSIGINT from script tick tick tick ✨ Done in 16.77s. bash-3.2$
For reference npm behavior: