Skip to content

Commit

Permalink
worker: improve JS-side debugging
Browse files Browse the repository at this point in the history
Do not print debug messages that indicate that a stdio stream
has drained; because `util.debuglog()` uses `console.log`, which
in turn uses stdio streams, this would otherwise have lead to an
endless loop.

PR-URL: nodejs#25312
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
Anna Henningsen authored and refack committed Jan 10, 2019
1 parent 468b245 commit 0fb2a07
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/internal/worker/io.js
Expand Up @@ -62,7 +62,8 @@ MessagePort.prototype.unref = MessagePortPrototype.unref;
// .onmessage events, and a function used for sending data to a MessagePort
// in some other thread.
MessagePort.prototype[kOnMessageListener] = function onmessage(payload) {
debug(`[${threadId}] received message`, payload);
if (payload.type !== messageTypes.STDIO_WANTS_MORE_DATA)
debug(`[${threadId}] received message`, payload);
// Emit the deserialized object to userland.
this.emit('message', payload);
};
Expand Down

0 comments on commit 0fb2a07

Please sign in to comment.