Skip to content

Commit 646f243

Browse files
authored
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.
1 parent 714257b commit 646f243

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/node/wrapper.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,18 @@ export class ParentProcess extends Process {
292292
const child = this.spawn()
293293
this.child = child
294294

295-
// Log both to stdout and to the log directory.
295+
// Log child output to stdout/stderr and to the log directory.
296296
if (child.stdout) {
297-
child.stdout.pipe(this.logStdoutStream)
298-
child.stdout.pipe(process.stdout)
297+
child.stdout.on("data", (data) => {
298+
this.logStdoutStream.write(data)
299+
process.stdout.write(data)
300+
})
299301
}
300302
if (child.stderr) {
301-
child.stderr.pipe(this.logStderrStream)
302-
child.stderr.pipe(process.stderr)
303+
child.stderr.on("data", (data) => {
304+
this.logStderrStream.write(data)
305+
process.stderr.write(data)
306+
})
303307
}
304308

305309
this.logger.debug(`spawned inner process ${child.pid}`)

0 commit comments

Comments
 (0)