Skip to content

Conversation

@matthewlehner
Copy link
Contributor

This will send the proper exit signal when stdin closed for #1308

I would like to automatically run webpack --watch as part of my application but, when it shuts down, the webpack process persists and continues running. I have observed that my application does close STDIN, however, webpack --watch is not currently checking if STDIN was closed or not.

@matthewlehner
Copy link
Contributor Author

Looks like Appveyor is broken.

@matthewlehner
Copy link
Contributor Author

@sokra – you mentioned that this feature was PR worthy in #1308, though I'm not sure if it's testable as it's using process.
I can't find any tests for the other process listeners in bin/webpack.js (here), so I'm not sure where to try adding tests for this.

Totally realize that this is probably an edge-case, but I'm happy to do the work to get it merged in, just need a bit of direction. Thanks!

@sokra
Copy link
Member

sokra commented Jul 31, 2015

yeah, there are no automatic tests for the CLI yet. You can goto webpack/test/browsertest and run node build.js. This uses the CLI. Then open tests.html for the browsertests.

@matthewlehner
Copy link
Contributor Author

So, I'm opening the node process with the ErlangVM and when stdin closes, it's shutting down. Without my patch, the process is never closed.

@matthewlehner
Copy link
Contributor Author

I just want to know what to do to get this merged

@sokra
Copy link
Member

sokra commented Aug 3, 2015

Not sure... I'm not so much into these OS internals to decide if this is fine. Would love to see more feedback about the fix. It's pretty radical and if wrong it would break stuff..

@jjt
Copy link

jjt commented Aug 4, 2015

The same change to brunch broke running it as a background process (brunch/brunch#998). From that discussion, they're going to make this behaviour opt-in through --stdin.

@josevalim
Copy link

👍 for this change, it is fairly common behaviour, but I would also follow @jjt advice of only checking stdin if a flag (for example, --stdin) is set.

@jjt
Copy link

jjt commented Aug 5, 2015

I'm just the messenger :)

@sokra
Copy link
Member

sokra commented Aug 8, 2015

@matthewlehner Do you want to update the PR to reflect @jjt and @josevalim ideas? And please rebase it to fix the CI bugs.

@matthewlehner
Copy link
Contributor Author

👍 I'm on it.

@matthewlehner
Copy link
Contributor Author

@sokra I've just implemented these changes with --watch-stdin as the new option.

I've rebased to master, but CI bugs still seem to be here.

@sokra
Copy link
Member

sokra commented Aug 12, 2015

The CI build fails because of incorrect code formating. Run npm test to see the results. Or run npm run beautify to fix it.

@matthewlehner
Copy link
Contributor Author

@sokra Ah ha, sorry about that. Everything passes now. 👍

@matthewlehner
Copy link
Contributor Author

Just checking if there's anything I can do to help move this along? Appveyor still seems broken for some reason..

@matthewlehner
Copy link
Contributor Author

@sokra Just rebased to master and everything passes. Is there anything else I need to do to get this merged?

sokra added a commit that referenced this pull request Aug 26, 2015
Send `exit(0)` when stdin closed.
@sokra sokra merged commit 1ed92ea into webpack:master Aug 26, 2015
@sokra
Copy link
Member

sokra commented Aug 26, 2015

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants