Skip to content
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

preact watch doesn't kill the process when the stdin pipe is closed #357

Closed
Ch4s3 opened this issue Sep 4, 2017 · 3 comments
Closed

preact watch doesn't kill the process when the stdin pipe is closed #357

Ch4s3 opened this issue Sep 4, 2017 · 3 comments
Labels

Comments

@Ch4s3
Copy link

Ch4s3 commented Sep 4, 2017

Npm Version: 5.3.0
Node version: 8.0.0
OS: macOS Sierra 10.12.16

Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I run preact watch by running npm run dev, which runs preact watch. But I'm doing this from a process run by another app that serves as the backend. This a app correctly spins up preact watch, but when it shuts down and closes the stdin pipe, the preact process keeps running, which I believe is not the correct behavior.

If the current behavior is a bug, please provide the steps to reproduce.
You should be able to reproduce this by running a bash script like the following:

#!/bin/bash
PORT=8080 npm run watch

Then exit with ctrl-c and run ps -ax | grep 'preact watch', you will likely see something like:

 4845 ??         0:03.29 node /Users/your_user_name/your_project/node_modules/.bin/preact watch

What is the expected behavior?
I would expect preact watch to follow the unix standard and it should either fork and persist, or it should kill itself when stdin closes. Preferably it would kill itself.

@Ch4s3
Copy link
Author

Ch4s3 commented Sep 4, 2017

Here is how Brunch handles the behavior I expect.

@Ch4s3
Copy link
Author

Ch4s3 commented Sep 4, 2017

My hot fix for anyone landing here from google is to run this script to start preact watch

#!/bin/bash
PORT=8080 npm run watch &
IPID=$!
cat # This waits until stdin closes
kill $IPID
sleep 1
kill -9 $IPID

@Ch4s3
Copy link
Author

Ch4s3 commented Sep 5, 2017

I'm guessing a pr would need to target run-webpack.js but I'm not familiar enough with preact or node's syscall handling to feel confident putting it together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants