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.
This commit is contained in:
Asher 2022-07-15 13:44:27 -05:00 committed by GitHub
parent 714257b3c5
commit 646f2436b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 5 deletions

View File

@ -292,14 +292,18 @@ export class ParentProcess extends Process {
const child = this.spawn() const child = this.spawn()
this.child = child 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) { if (child.stdout) {
child.stdout.pipe(this.logStdoutStream) child.stdout.on("data", (data) => {
child.stdout.pipe(process.stdout) this.logStdoutStream.write(data)
process.stdout.write(data)
})
} }
if (child.stderr) { if (child.stderr) {
child.stderr.pipe(this.logStderrStream) child.stderr.on("data", (data) => {
child.stderr.pipe(process.stderr) this.logStderrStream.write(data)
process.stderr.write(data)
})
} }
this.logger.debug(`spawned inner process ${child.pid}`) this.logger.debug(`spawned inner process ${child.pid}`)