Skip to content

Commit

Permalink
Add OS check to determine whether or not to detach spawned child proc…
Browse files Browse the repository at this point in the history
…ess.
  • Loading branch information
snack-able authored and parkerziegler committed May 3, 2019
1 parent cc7cef2 commit bd78586
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/webpack-dashboard.js
Expand Up @@ -17,6 +17,7 @@ const pkg = require("../package.json");
const main = (module.exports = opts => {
opts = opts || {};
const argv = typeof opts.argv === "undefined" ? process.argv : opts.argv;
const isWindows = process.platform === "win32";

program.version(pkg.version);
program.option("-c, --color [color]", "Dashboard color");
Expand All @@ -43,7 +44,7 @@ const main = (module.exports = opts => {
child = spawn(command, args, {
env,
stdio: [null, null, null, null],
detached: true
detached: !isWindows
});
}

Expand Down Expand Up @@ -91,7 +92,7 @@ const main = (module.exports = opts => {
});

process.on("exit", () => {
process.kill(process.platform === "win32" ? child.pid : -child.pid);
process.kill(isWindows ? child.pid : -child.pid);
});
} else {
server.on("connection", socket => {
Expand Down

0 comments on commit bd78586

Please sign in to comment.