From 9eb982dc9226291be847a030eed50e243d332c0f Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sat, 27 Apr 2024 06:01:09 +0200 Subject: [PATCH] Add an inspector condition to disabling stdout --- svr.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/svr.js b/svr.js index 8c9a90a..7b28b07 100644 --- a/svr.js +++ b/svr.js @@ -390,6 +390,12 @@ try { } catch (err) { // Don't use hexstrbase64 } +var inspector = undefined; +try { + inspector = require("inspector"); +} catch (err) { + // Don't use inspector +} var zlib = require("zlib"); var tar = undefined; try { @@ -934,8 +940,8 @@ function calculateNetworkIPv4FromCidr(ipWithCidr) { }).join("."); } -if (!process.stdout.isTTY) { - // When stdout is not a terminal, disable it to improve performance of SVR.JS +if (!process.stdout.isTTY && (!inspector || !inspector.url())) { + // When stdout is not a terminal and not attached to an Node.JS inspector, disable it to improve performance of SVR.JS console.log = function () {}; process.stdout.write = function () {}; process.stdout._write = function () {};