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(core): drain stdout before exit in print-affected #12559
fix(core): drain stdout before exit in print-affected #12559
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
if (process.stdout.writableNeedDrain) { | ||
process.stdout.once('drain', resolve); | ||
} else { | ||
resolve(); | ||
} |
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.
alternative:
if (process.stdout.writableNeedDrain) { | |
process.stdout.once('drain', resolve); | |
} else { | |
resolve(); | |
} | |
process.stdout.write('', resolve); |
Notably, writableNeedDrain
was added in node 14.17.0, so on earlier node versions, the code that checks writableNeedDrain
won't wait for drain; that is the current behaviour, so that's somewhat moot.
Piping a large print-affected output to another command, such as cat or jq, resulted in broken json output as the node process can exit before the output is fully written. The process.stdout stream needs to wait to drain before process.exit.
8c8c7ab
to
31ecffa
Compare
Piping a large print-affected output to another command, such as cat or jq, resulted in broken json output as the node process can exit before the output is fully written. The process.stdout stream needs to wait to drain before process.exit. (cherry picked from commit 0ff93dd)
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Piping a large print-affected output to another command, such as cat or jq, resulted in broken json output as the node process can exit before the output is fully written. The process.stdout stream needs to wait to drain before process.exit.
Current Behavior
Sometimes, when I pipe
nx print-affected --all
to another command, such ascat
orjq
, the output will be truncated. For example:Expected Behavior
Related Issue(s)
I don't think this issue has been reported yet.
Fixes #