- Operating System: Windows 10.0.17134 Build 17134
- Node Version: 8.11.1
- NPM Version: 5.6.0
- webpack Version: 4.39.0
- webpack-dev-server Version: 3.7.2
- Browser: Not Applicable
Expected Behavior
webpack-dev-server should be killed with childProcess.kill() after spawning it with require("child_process").spawn().
Actual Behavior
webpack-dev-server is orphaned instead of being killed in the above scenario.
Steps to Reproduce
Create a folder with the following package.json:
{
"name": "webpack-dev-server-process-exit-bug-test",
"dependencies": {
"webpack": "^4.39.0",
"webpack-cli": "^3.3.6",
"webpack-dev-server": "^3.7.2"
}
}
Add a test.js file:
const { spawn: spawnProcess } = require("child_process");
let devServerProcess = spawnProcess(
".\\node_modules\\.bin\\webpack-dev-server", [],
{ shell: true, stdio: "inherit" });
setTimeout(_ => {
devServerProcess.kill();
console.log("Trying to kill webpack-dev-server...");
}, 5000);
Add a src.js file to satisfy the webpack zero-config defaults:
Run npm i then node test.js and check the running processes on your system. The webpack-dev-server node has not been killed as expected.
Note
This issue still occurs when the stdio option is not supplied to the spawn function.
Expected Behavior
webpack-dev-servershould be killed withchildProcess.kill()after spawning it withrequire("child_process").spawn().Actual Behavior
webpack-dev-serveris orphaned instead of being killed in the above scenario.Steps to Reproduce
Create a folder with the following
package.json:Add a
test.jsfile:Add a
src.jsfile to satisfy thewebpackzero-config defaults:Run
npm ithennode test.jsand check the running processes on your system. Thewebpack-dev-servernode has not been killed as expected.Note
This issue still occurs when the
stdiooption is not supplied to thespawnfunction.