From 58a236e0ceab0d04bd287b76c77180cd20f91c25 Mon Sep 17 00:00:00 2001 From: Remy Sharp Date: Thu, 18 Aug 2016 15:54:39 +0100 Subject: [PATCH] fix: use stdin=inhert on vanilla run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: non-utf8 stdin processing Fixes #890 Ref https://github.com/FormidableLabs/webpack-dashboard/issues/16 The library blessed inside of the webpack-dashboard does some funky stuff with std streams and the expectation of the encoding. I'm not 100% sure of this change, I've got to see all the tests, but this tweak moves to inherit the child's stdin and doesn't purposely encode the stdin stream as utf8 (which, I don't recall exactly why I did this in the first place…though I'm fairly sure it was another issue somewhere else in nodemon). * fix: use stdin:inherit when we're not forked * fix: don't use inherit when required * style: lint * style: I am going to 🐎 kick the lint in the 🌰 --- lib/monitor/run.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/monitor/run.js b/lib/monitor/run.js index 5b534f53..a012ac35 100644 --- a/lib/monitor/run.js +++ b/lib/monitor/run.js @@ -37,7 +37,9 @@ function run(options) { var stdio = ['pipe', 'pipe', 'pipe']; if (config.options.stdout) { - stdio = ['pipe', process.stdout, process.stderr]; + stdio = [process.send || config.required ? 'pipe' : 'inherit', + process.stdout, + process.stderr,]; } var sh = 'sh'; @@ -227,7 +229,8 @@ function run(options) { // connect stdin to the child process (options.stdin is on by default) if (options.stdin) { process.stdin.resume(); - process.stdin.setEncoding('utf8'); + // FIXME decide whether or not we need to decide the encoding + // process.stdin.setEncoding('utf8'); process.stdin.pipe(child.stdin); bus.once('exit', function () {