Skip to content

Commit e8a6cc8

Browse files
addaleaxBridgeAR
authored andcommittedJan 17, 2019
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>
1 parent c6adf4b commit e8a6cc8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎lib/internal/worker/io.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ MessagePort.prototype.unref = MessagePortPrototype.unref;
6262
// .onmessage events, and a function used for sending data to a MessagePort
6363
// in some other thread.
6464
MessagePort.prototype[kOnMessageListener] = function onmessage(payload) {
65-
debug(`[${threadId}] received message`, payload);
65+
if (payload.type !== messageTypes.STDIO_WANTS_MORE_DATA)
66+
debug(`[${threadId}] received message`, payload);
6667
// Emit the deserialized object to userland.
6768
this.emit('message', payload);
6869
};

0 commit comments

Comments
 (0)