From f93035759175bfd35c5e7241e7626e4ddd54ff17 Mon Sep 17 00:00:00 2001 From: Ray Zane Date: Thu, 15 Mar 2018 10:38:56 -0400 Subject: [PATCH 1/2] Allow the `watch` command to accept a new option `--stdin`. This means that the program will exit when STDIN closes. This is consisent with the behavior in Webpack and Brunch. --- src/cli.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cli.js b/src/cli.js index e3baf7265a6..60bbab54d4e 100755 --- a/src/cli.js +++ b/src/cli.js @@ -71,6 +71,7 @@ program '--hmr-hostname ', 'set the hostname of HMR websockets, defaults to location.hostname of current window' ) + .option('--stdin', 'exit the process when stdin is closed') .option('--no-hmr', 'disable hot module replacement') .option('--no-cache', 'disable the filesystem cache') .option('--no-source-maps', 'disable sourcemaps') @@ -146,6 +147,11 @@ async function bundle(main, command) { process.env.NODE_ENV = process.env.NODE_ENV || 'development'; } + if (command.stdin) { + process.stdin.on('end', () => process.exit(0)); + process.stdin.resume(); + } + const bundler = new Bundler(main, command); if (command.name() === 'serve') { From 5177a33fd660d225466a5cfd6d6d82640f69cd83 Mon Sep 17 00:00:00 2001 From: David Nagli Date: Mon, 19 Mar 2018 14:48:20 -0400 Subject: [PATCH 2/2] Add missing bracket from bad merge --- src/cli.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cli.js b/src/cli.js index 410b32c4c48..49a91003c95 100755 --- a/src/cli.js +++ b/src/cli.js @@ -161,7 +161,8 @@ async function bundle(main, command) { command.https = { cert: command.cert, key: command.key - }; + }; + } const bundler = new Bundler(main, command);