Skip to content

Commit 6e7ce4b

Browse files
committed
fix: swallow child.stdin err
This is a weird case where stdin isn't fully connected and throws in ubuntu 16.04 (replicated in a Docker image). Fixes #1195
1 parent d78bf3d commit 6e7ce4b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/monitor/run.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ function run(options) {
6767

6868
var args = runCmd ? utils.stringify(executable, cmd.args) : ':';
6969
var spawnArgs = [sh, [shFlag, args]];
70-
debug('spawning', args);
7170

7271
if (utils.version.major === 0 && utils.version.minor < 8) {
7372
// use the old spawn args :-\
@@ -95,10 +94,15 @@ function run(options) {
9594
env: env,
9695
stdio: stdio,
9796
});
97+
utils.log.detail('forking');
98+
debug(forkArgs);
9899
} else {
100+
utils.log.detail('spawning');
99101
child = spawn.apply(null, spawnArgs);
102+
debug(spawnArgs);
100103
}
101104

105+
102106
if (config.required) {
103107
var emit = {
104108
stdout: function (data) {
@@ -257,6 +261,10 @@ function run(options) {
257261
process.stdin.resume();
258262
// FIXME decide whether or not we need to decide the encoding
259263
// process.stdin.setEncoding('utf8');
264+
265+
// swallow the stdin error if it happens
266+
// ref: https://github.com/remy/nodemon/issues/1195
267+
child.stdin.on('error', () => {});
260268
process.stdin.pipe(child.stdin);
261269

262270
bus.once('exit', function () {

0 commit comments

Comments
 (0)