8000 lib: fix worker threads can't read stdout by leeight · Pull Request #24652 · nodejs/node · GitHub
[go: up one dir, main page]

Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file 8000
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions lib/internal/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,22 @@ class Worker extends EventEmitter {
< 783D /td> case messageTypes.STDIO_PAYLOAD:
{
const { stream, chunk, encoding } = message;
return this[kParentSideStdio][stream].push(chunk, encoding);
if (this[kParentSideStdio]) {
this[kParentSideStdio][stream].push(chunk, encoding);
} else {
debug(`[${threadId}] explicitly closes stdout for ${this.threadId}`);
}
return;
}
case messageTypes.STDIO_WANTS_MORE_DATA:
{
const { stream } = message;
return this[kParentSideStdio][stream][kStdioWantsMoreDataCallback]();
if (this[kParentSideStdio]) {
this[kParentSideStdio][stream][kStdioWantsMoreDataCallback]();
} else {
debug(`[${threadId}] explicitly closes stdout for ${this.threadId}`);
}
return;
}
}

Expand Down
0