-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Exit when STDIN closes #1004
Exit when STDIN closes #1004
Conversation
that the program will exit when STDIN closes. This is consisent with the behavior in Webpack and Brunch.
Force pushed to trigger a CI rebuild. I suspect that the Node 6 tests are flaking. |
@rzane Ya, we have some flakiness issues with Node 6 tests |
Codecov Report
@@ Coverage Diff @@
## master #1004 +/- ##
==========================================
+ Coverage 89.27% 92.38% +3.11%
==========================================
Files 69 69
Lines 3393 2680 -713
==========================================
- Hits 3029 2476 -553
+ Misses 364 204 -160
Continue to review full report at Codecov.
|
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.
👍
I guess I don't understand why this option is necessary. Could you give me more details about your setup? How are you running parcel? |
I am writing a Phoenix application. Phoenix is a web framework written in Elixir. Elixir doesn't have a way to send a kill signal to a process. It is common for VMs to not expose those operations as it is hard to provide an unified API across multiple OS and hardware. As such, it is quite common for UNIX tools to exit when STDIN closes. Specifically, my problem is that Phoenix provides the ability to start an asset bundler when the server starts. And, when the Phoenix server shuts down, it closes STDIN. Unfortunately, because parcel doesn't exit when STDIN closes, parcel doesn't die. It just stays alive. As mentioned in the original description, Webpack and Brunch currently offer this functionality. |
hmm, ok. Is there any reason to not make this default behavior instead of adding an option? |
Yes. If you run parcel with Here's the issue report of that specific problem: brunch/brunch#998. |
I've written a little plugin for parcel that causes it to die when stdin is closed. |
I think @dparnell's plugin is probably an adequate and simple solution for this specific problem. |
You could also make a small wrapper script like this: #!/bin/sh
"$@" &
pid=$!
while read line ; do
:
done
kill -KILL $pid https://hexdocs.pm/elixir/Port.html#module-zombie-processes I'm going to close this since it is possible to work around. I don't think this is Parcel's problem. |
This PR adds a new flag to the watch command that instructs Parcel to exit when STDIN closes. This is consistent with the behavior in Webpack and Brunch.
Here's a really clear synopsis from this Brunch issue:
As such, it is common for Unix processes to exit when STDIN closes.
Relevant links:
exit(0)
when stdin closed. webpack/webpack#1311