-
Notifications
You must be signed in to change notification settings - Fork 30k
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
node --help | head -n1
throws an error
#51448
Comments
Could you elaborate a little on why you need this? Is it causing issues for you or just something you noticed out of curiosity? |
node --help | head -n1
throws an error but still exits with code 0node --help | head -n1
throws an error
Ohhhh so that's why it exited with code 0! 🤦♀️ Context of how I noticed this: I was trying to trim the massive |
This works: node -e 'console.log("a\n".repeat(2000))' | head -n5 This works: node -e 'process.stdout.write("a\n".repeat(2000))' | head -n5 This is what the node/lib/internal/main/print_help.js Lines 200 to 233 in c25878d
Specifically note the use of multiple This FAILS: node -e 'for (const i of Array(1000).keys()) process.stdout.write(`${i}\n`)' | head -n5 This works: node -e 'for (const i of Array(1000).keys()) console.log(i)' | head -n5 What I suggest:
This would:
|
PR-URL: nodejs#51463 Fixes: nodejs#51448 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: nodejs#51463 Fixes: nodejs#51448 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Version
v21.5.0
Platform
Linux codespaces-6c49bb 6.2.0-1018-azure #18~22.04.1-Ubuntu SMP Tue Nov 21 19:25:02 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
node --help | head -n1
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
expected behaviour is what deno and bun do: don't error lol
What do you see instead?
Additional information
No response
The text was updated successfully, but these errors were encountered: