Skip to content

[Bug?]: Yarn Berry's internal shell component sometimes fails to flush output #6733

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

Open
1 task
gjvoosten opened this issue Mar 20, 2025 · 0 comments
Open
1 task
Labels
bug Something isn't working

Comments

@gjvoosten
Copy link

gjvoosten commented Mar 20, 2025

Self-service

  • I'd be willing to implement a fix

Describe the bug

I have a script in my package.json like:

  "scripts": {
    "test-merge": "./combine-test-results.sh ./test-input/*.xml > ./test-output.xml"
  }

(fully runnable example below)

Repeatedly running:

yarn run test-merge ; tail test-output.xml

should always show:

................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
]]></system-out>
  <system-err><![CDATA[]]></system-err>
</testsuite>
</testsuites>

but sometimes the output is cut short.
(We first noticed this when our pipelines would intermittently fail because the generated XML files were invalid.)

If I add another script that forces to use bash:

  "scripts": {
    "test-merge": "./combine-test-results.sh ./test-input/*.xml > ./test-output.xml",
    "test-merge-bash": "bash -c './combine-test-results.sh ./test-input/*.xml > ./test-output.xml'"
  }

and repeatedly run:

yarn run test-merge-bash ; tail test-output.xml

the output is always complete.

This leads me to believe that this is a bug in Yarn Berry's internal shell component, which sometimes fails to flush the output.

To reproduce

berrybug.zip

Environment

System:
    OS: Linux 6.13 Fedora Linux 41 (Workstation Edition)
    CPU: (22) x64 Intel(R) Core(TM) Ultra 9 185H
  Binaries:
    Node: 20.10.0 - /tmp/xfs-49a54522/node
    Yarn: 4.7.0 - /tmp/xfs-49a54522/yarn
    npm: 10.2.3 - /tmp/xfs-49a54522/npm
@gjvoosten gjvoosten added the bug Something isn't working label Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant