From 646f2436b03dd209059f99f8fc5fa49737f873b8 Mon Sep 17 00:00:00 2001 From: Asher Date: Fri, 15 Jul 2022 13:44:27 -0500 Subject: [PATCH] fix: output lost after hotswapping (#5346) I think the pipe was closing the other streams when the child stream closed so instead just write it one way. --- src/node/wrapper.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/node/wrapper.ts b/src/node/wrapper.ts index 42151ab1a..40540d3b7 100644 --- a/src/node/wrapper.ts +++ b/src/node/wrapper.ts @@ -292,14 +292,18 @@ export class ParentProcess extends Process { const child = this.spawn() this.child = child - // Log both to stdout and to the log directory. + // Log child output to stdout/stderr and to the log directory. if (child.stdout) { - child.stdout.pipe(this.logStdoutStream) - child.stdout.pipe(process.stdout) + child.stdout.on("data", (data) => { + this.logStdoutStream.write(data) + process.stdout.write(data) + }) } if (child.stderr) { - child.stderr.pipe(this.logStderrStream) - child.stderr.pipe(process.stderr) + child.stderr.on("data", (data) => { + this.logStderrStream.write(data) + process.stderr.write(data) + }) } this.logger.debug(`spawned inner process ${child.pid}`)