-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Bug]: yarn workspaces foreach
always exits with status 0 even on error
#3334
Comments
@merceyz Following your comment, I gave this another try using Node@16 and I can still reproduce this issue 😕
|
Hi! 👋 This issue looks stale, and doesn't feature the Note that we require Sherlock reproductions for long-lived issues (rather than standalone git repositories or similar) because we're a small team. Sherlock gives us the ability to check which bugs are still affecting the master branch at any given point, and decreases the amount of code we need to run on our own machines (thus leading to faster bug resolutions). It helps us help you! 😃 If you absolutely cannot reproduce a bug on Sherlock (for example because it's a Windows-only issue), a maintainer will have to manually add the |
@merceyz I'm not familiar with Sherlock enough to reproduce this, could you add the tag |
I initially assumed to have the same issue. Turns out the failing script swallowed the error. At least I've written the corresponding sherlock tests while debugging: Playground This issue seems not to be reproducible. Any feedback on this @akphi? |
@remolueoend On my machine, I just tried to do do yarn workspace pkg1 doSomething
# command not found: error
echo $?
127 the exit code is 127 it seems. What do you mean by "the failing script swallowed the error`? Also nice work on the sherlock test! |
Sorry, that was related to a problem in a personal project and why I investigated this issue in the first place. But based on my personal repository and the sherlock tests, this issue seems not reproducible anymore on the newest version (>= 3.2.0). Can you still reproduce it? |
I just updated to As said, I think the problem is because the script throws exit code
are all returning |
Yes indeed, and therefore yarn indicates the failure of a subtask correctly. What is the error code in your local repo when running |
Supposed, you mean
|
I actually meant |
@remolueoend whats your environment like (Node, OS)? |
Linux x64 with node v17.7. Can you show us once again the full output when running |
Sure, ❯ yarn doSomething:standard; echo $?
➤ YN0000: [pkg1]: Process started
➤ YN0000: [pkg1]: command not found: error
➤ YN0000: [pkg1]: Process exited (exit code 127), completed in 0s 65ms
➤ YN0000: [pkg2]: Process started
➤ YN0000: [pkg2]: build
➤ YN0000: [pkg2]: Process exited (exit code 0), completed in 0s 34ms
➤ YN0000: Done in 0s 108ms
1
❯ yarn --version
3.2.0 |
That seems like the expected behavior no? The exit code of |
@remolueoend omg you're right 😭. So this is no longer a problem anymore 🎉 Thank you so much for your patience!! I'll close the issue here and go to cry since I should have realized this 10 comments ago |
Hey @akphi, no worries, that's why we're here, glad I could help! |
Self-service
Describe the bug
In
Yarn@3.0.1
, when I run a command withyarn workspaces foreach
, it still return as successful even when a workspace process failed.To reproduce
This is my repro: akphi/issue-repo#1
I setup a test monorepo with 2 workspaces
pkg1
andpkg2
. Each workspace has a script calleddoSomething
.pkg1
will exit with code 1 since the commanderror
is not known.At the root directory, if we run the following command, we got some unexpected result:
Environment
System:
OS: macOS 11.5.1
CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Binaries:
Node: 14.17.1 - /private/var/folders/95/y32364512q77c1dvhkpnr_n80000gn/T/xfs-02ae3755/node
Yarn: 3.0.1 - /private/var/folders/95/y32364512q77c1dvhkpnr_n80000gn/T/xfs-02ae3755/yarn
npm: 6.14.13 - ~/.nvm/versions/node/v14.17.1/bin/npm
npmPackages:
jest: 27.0.6 => 27.0.6
Additional context
Related to #2486
The text was updated successfully, but these errors were encountered: