-
-
Notifications
You must be signed in to change notification settings - Fork 302
fix(bin): write into streams before exit #127
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
Conversation
With which node version do you have the problem? As far as I see it was fixed in node 0.12. |
I tried it with node 4 and 6. Was wondering as well why I ran into this issue |
I will provide you with an example |
I created 2 examples which uses exactly the same code as in the examples in this repo beside the amount of props. The first example with a component with 100 props and the second with 1000 props. Please try if the second one fails for you as well. |
Thanks, yes I can reproduce this. Reading more about writing to stdout I found this in the docs:
So as you are piping we are not in a tty anymore which makes the stream write non-blocking and the Instead of doing this draining logic, I would more lean to remove @fkling What do you think? |
If that works, I'm all for it since it's the simpler solution. However, we are invoking |
Hey, I removed the process.exit completely now.
What I don't like and hopefully you have a better idea is line
Which I needed to implement because of the removed |
`Unknown resolver: "${argv.resolver}" is neither a built-in resolver ` + | ||
`nor can it be found locally ("${resolverPath}")` | ||
); | ||
process.exitCode = 1; |
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.
Couldn't we just call process.exit(1)
here?
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.
Actually yes, but I wanted to get rid of the eslint no-process-exit: 0
line :D
I would say you should only disable a linting rule if there is no other way.
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.
Well, that rule is more targeted towards arbitrary modules. From the docs:
This is a dangerous operation because it can occur in any method at any point in time, potentially stopping a Node.js application completely when an error occurs.
So, using it in the executable file itself is completely valid :)
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.
Seems legit. But disabling this rule could lead to the same problem in the future.
So I would prefer to have this rule enabled also here. Are the new changes ok for you?
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.
You can always disable the rule for just that one line ;)
But yeah, I guess this is OK.
I replaced the |
@danez Hey, could we merge the PR now? |
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.
lgtm
@danez thanks a lot :) |
Thanks for this! I'll release a new version shortly. |
I run into an issue, that the output from
react-docgen
is cut off, if the output is too big.This only happens if I try to pipe the output like so:
Or like so:
After some research I found this issue:
mochajs/mocha#333
And it works with the solution they used:
https://github.com/mochajs/mocha/pull/1440/files
So hopefully you can use this fix. I will try to help where I can to get it merged. Another solution could be this package: https://www.npmjs.com/package/exit