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: #25312
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
addaleax authored and BridgeAR committed Jan 17, 2019
1 parent c6adf4b commit e8a6cc8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/internal/worker/io.js
Original file line number Diff line number Diff line change
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 e8a6cc8

Please sign in to comment.