-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Not compatible with Node v6.0.0
or Node v6.1.0
?
#530
Comments
|
Same issue here, after an x amount of characters, it returns an EOF |
Apparently |
oh, interesting. I will check that, and PR is welcome |
Probably relevant issue: nodejs/node#6456. |
@nicola do you know what the line/lines are that cause this issue? |
@cbetta nope, but see here: nodejs/node#6456 |
@nicola ok thanks. Was just hoping to see if i could make a local patch that fixes it for us by changing the way we exit. |
here's a workaround I'm considering landing in yargs for this problem: |
@hustcer @cbetta @zhiyelee I pulled the tiny bit of logic that yargs uses to solve this problem into a shim: https://github.com/yargs/set-blocking UglifyJS2 uses this same approach, which I modeled yargs' fix after: https://github.com/mishoo/UglifyJS2/pull/1061/files |
@bcoe that's awesome. Would love to see if we can make a patch for commander that uses this fix. What would that take? |
@cbetta yargs writes all of its output in one call, prior to calling
set blocking to true: const setBlocking = require('set-blocking')
setBlocking(true) output your content like usual: console.log(commander.generateCLI()); now exit: process.exit(0); Note that you need to set blocking to true, prior to printing the console output. |
@bcoe grat work! Thanks for making it modular! |
@cbetta [process.stdout, process.stderr].forEach(stream => {
if (stream._handle && typeof stream._handle.setBlocking === 'function') {
stream._handle.setBlocking(true);
}
}); |
@hustcer my hero! Do you think it would be worth shipping as a module that people can easily include? E.g. |
@cbetta that's what https://github.com/yargs/set-blocking does, also the issue will be fixed soon in core, see nodejs/node#6980. |
@lpinca ah now that earlier comment makes sense. Thanks for clarifying. |
I think this can be closed now, It should have been fixed in node 6.2.1. |
thanks @lpinca |
Future readers: this may still be an issue on Windows TTY which are asynchronous according to: Please open a new issue if you are seeing truncated help. |
It's strange that when I switch to
Node v6.1.0
to execute myapp.js -h
, just to find the output help content was truncated as:When I switch back to
Node v5.11.1
, it works well:Whether this is a bug or not?
The text was updated successfully, but these errors were encountered: