forked from svrjs/svrjs
Add an inspector condition to disabling stdout
This commit is contained in:
parent
3839f4d1df
commit
9eb982dc92
1 changed files with 8 additions and 2 deletions
10
svr.js
10
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 () {};
|
||||
|
|
Reference in a new issue