From 052b7ed25c34023286929b098c2f81fdfcb1ab1d Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 2 Jan 2019 16:07:20 +0100 Subject: [PATCH] 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. --- lib/internal/worker/io.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/worker/io.js b/lib/internal/worker/io.js index d249ba8508b7af..ad8056b5b9108a 100644 --- a/lib/internal/worker/io.js +++ b/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); };