-
-
Notifications
You must be signed in to change notification settings - Fork 425
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
fix: kill other running tasks on failure #1117
fix: kill other running tasks on failure #1117
Conversation
0402ef7
to
66f8c04
Compare
Hello, thanks for the PR. Currently we use |
I believe we are intentionally disabling this error for parallel tasks, and only enabling it for subtasks (that run serially): https://github.com/okonet/lint-staged/blob/531275cbdb40fa9ec7ee972ee129e6323b9ab9ee/lib/runAll.js#L143-L149 |
That was the first thing I tried. It just marks the task as interrupted in the terminal but doesn't actually exit.
Like you mention - it's just the task life cycle. We manage what those tasks actually do in
That would work as well but...
It is a more elegant solution though, so if you were to argue that I should check for the existence of |
Thanks for the explanation! Just to make sure, does this kill all tasks or just the subtasks that we currently set to fail on error? We should still sync those settings. |
Codecov Report
@@ Coverage Diff @@
## master #1117 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 25 25
Lines 678 691 +13
Branches 179 180 +1
=========================================
+ Hits 678 691 +13
Continue to review full report at Codecov.
|
Looks like Node.js 12 Windows tests failed, random? |
I happen to be on windows and so tried to reproduce this. I'm seeing more, different errors even on master though. |
That said, I believe this might have to do with the fact that I didn't mock pidtree and maybe it tries to get something like pid 0 and that returns something on nix systems but not on windows (just a theory). |
Our Windows tests could always use more love and attention, thanks. |
Just ran this with #1118 merged in locally in my Windows 11 environment and at least here, everything passes now. 👍 |
It's probably not related to this, but I'm getting double-output from terminal:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
🎉 This PR is included in version 12.3.6 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I noticed that too and double-checked with previous master, where I saw it happen as well (no fancy options - just running default concurrently and waiting for tests to finish running). I figured that you might do this on purpose, so that the final output is always the list of tasks, even when there are potentially long error logs.
Thanks! It's been a pleasure working with you on this. 🙂 |
It might be that we print the task error output too soon, and |
This kills already running tasks as soon as an error is emitted by another task. Making it possible to interrupt concurrently running tasks on first failure.
Aside from the included unmocked test, you can also try it out by staging a linting error and changing the lint-staged configuration in this repo to
.lintstagedrc.mjs
with the following content:... and running:
node ./bin/lint-staged.js
I have changed the precedence of the tags, since I think it would be confusing to users to see the signals when we consciously kill tasks. (With the previous order, they would have seen
SIGTERM
. This way, it isKILLED
.)There are two minor caveats:
shell: true
.Fixes #594