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: https://github.com/nodejs/node/pull/25312
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Anna Henningsen 2019-01-02 16:07:20 +01:00
parent b22c86ed3b
commit 9dfbc391fa
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9

View File

@ -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);
};