From 7e580ef5bb2dbd9b46d0c18dc1ba55404de2e7ec Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sun, 22 Jan 2017 23:10:51 +0330 Subject: [PATCH 1/4] Hide in DEBUG_FD deprecation warning in Webstorm Fixes #410 + Intellij idea --- src/node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node.js b/src/node.js index ea6a8967..5b16b893 100644 --- a/src/node.js +++ b/src/node.js @@ -58,7 +58,7 @@ exports.inspectOpts = Object.keys(process.env).filter(function (key) { * $ DEBUG_FD=3 node script.js 3>debug.log */ -if ('DEBUG_FD' in process.env) { +if ('DEBUG_FD' in process.env && !('FORCE_COLOR' in process.env) && !('DEBUG_COLORS' in process.env) ) { util.deprecate(function(){}, '`DEBUG_FD` is deprecated. Override `debug.log` if you want to use a different log function (https://git.io/vMUyr)')() } From eb0bcadaa0105c7bae1cba3ff819553f7807e178 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sun, 22 Jan 2017 23:23:34 +0330 Subject: [PATCH 2/4] Hide in DEBUG_FD deprecation warning in Webstorm Fixes #410 --- src/node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node.js b/src/node.js index 5b16b893..90dcf944 100644 --- a/src/node.js +++ b/src/node.js @@ -58,7 +58,7 @@ exports.inspectOpts = Object.keys(process.env).filter(function (key) { * $ DEBUG_FD=3 node script.js 3>debug.log */ -if ('DEBUG_FD' in process.env && !('FORCE_COLOR' in process.env) && !('DEBUG_COLORS' in process.env) ) { +if ('DEBUG_FD' in process.env && !('DEBUG_COLORS' in process.env && process.env.DEBUG_FD == 1)) { util.deprecate(function(){}, '`DEBUG_FD` is deprecated. Override `debug.log` if you want to use a different log function (https://git.io/vMUyr)')() } From 5350863a614c33ec4861e5805c1b4ad128833759 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 23 Jan 2017 11:53:44 +0330 Subject: [PATCH 3/4] whitelist DEBUG_FD for values 1 and 2 only --- src/node.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/node.js b/src/node.js index 90dcf944..599da95c 100644 --- a/src/node.js +++ b/src/node.js @@ -58,11 +58,12 @@ exports.inspectOpts = Object.keys(process.env).filter(function (key) { * $ DEBUG_FD=3 node script.js 3>debug.log */ -if ('DEBUG_FD' in process.env && !('DEBUG_COLORS' in process.env && process.env.DEBUG_FD == 1)) { - util.deprecate(function(){}, '`DEBUG_FD` is deprecated. Override `debug.log` if you want to use a different log function (https://git.io/vMUyr)')() +var fd = parseInt(process.env.DEBUG_FD, 10) || 2; + +if (1 !== fd && 2 !== fd) { + util.deprecate(function(){}, '`DEBUG_FD` is deprecated. Override `debug.log` if you want to use a different log function (https://git.io/debug_fd)')() } -var fd = parseInt(process.env.DEBUG_FD, 10) || 2; var stream = 1 === fd ? process.stdout : 2 === fd ? process.stderr : createWritableStdioStream(fd); From 2a8f8a42c0b7d443d4345577499da66930110e76 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 23 Jan 2017 23:55:15 +0330 Subject: [PATCH 4/4] Use appreciate depreciation message --- src/node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node.js b/src/node.js index 599da95c..4fa564b0 100644 --- a/src/node.js +++ b/src/node.js @@ -61,7 +61,7 @@ exports.inspectOpts = Object.keys(process.env).filter(function (key) { var fd = parseInt(process.env.DEBUG_FD, 10) || 2; if (1 !== fd && 2 !== fd) { - util.deprecate(function(){}, '`DEBUG_FD` is deprecated. Override `debug.log` if you want to use a different log function (https://git.io/debug_fd)')() + util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')() } var stream = 1 === fd ? process.stdout :