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
Failed to load files.
Loading
Diff view
Diff view
lib: fix worker threads can't read stdout
Fix: #24636
  • Loading branch information
leeight committed Nov 26, 2018
commit d2beb1c9eafccebfa89edd3402cbc585ae1af79c
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 {
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