Skip to content
Permalink
Browse files

worker: improve JS-side debugging

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 2, 2019
1 parent c6adf4b commit e8a6cc8802b909b31c4a4ec7333170ea0e53f0be
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/internal/worker/io.js
@@ -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);
};

0 comments on commit e8a6cc8

Please sign in to comment.
You can’t perform that action at this time.