-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Stop watch process when process.stdin ends closes #1753 #1754
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
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks! If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact [email protected] if you have any questions. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Should this also happen for |
I don't think this needs to happen for To be honest, i'm not 100% familiar with what $ echo "{ foo: 'bar' }" | node -e 'process.stdin.on("data", d => console.log(d.toString()))'
// { foo: 'bar' }
$ echo "{ foo: 'bar' }" | node -e 'process.stdin.on("end", () => console.log("hello world"))'
//
$ echo "{ foo: 'bar' }" | node -e 'process.stdin.on("end", () => console.log("hello world")); process.stdin.resume()'
// hello world |
True for build, but test runs a watcher by default. |
@gaearon have just tested this, and you are right, the test process hangs around. |
@@ -42,6 +42,11 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { | |||
process.exit(1); | |||
} | |||
|
|||
process.stdin.on('end', function() { |
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.
Let's add a comment here (and in the other file) explaining what this does and linking to the issue.
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.
👍
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.
Do you think it's worth toggling this with an env var? Webpack uses --stdin
to turn this behaviour on - although testing worked fine, I don't want to inadvertently break some other scenarios.
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.
If we break we'll learn from that. I think it's fine to start with on by default in the next major (technically minor since we're in 0.x), and see what breaks.
@@ -44,3 +44,8 @@ argv.push( | |||
); | |||
// @remove-on-eject-end | |||
jest.run(argv); | |||
|
|||
process.stdin.on('end', function() { |
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.
We need to only do this in non-CI mode. Move this into if
statement below plz.
13d6686
to
14784ae
Compare
Design/style Q: would it make sense to make a helper, since this code is duplicated across two files? Like: // in a new dev script
function addExitHandlersToProcess(process) {
process.stdin.on('end', function() {
process.exit(0);
});
process.stdin.resume();
}
} And call it in start.js and test.js. Along with cutting down duplication, it would add some self-documentation. |
We could put it in |
For some reason this breaks the CI. |
I’m open to getting this in, but the CI needs to pass. |
What has been done
process.stdin
fires anend
event, the process exits with a0
exit codeHow has this been tested