Skip to content

Commit

Permalink
Whitelist DEBUG_FD for values 1 and 2 only Fixes #410 (#415)
Browse files Browse the repository at this point in the history
* Hide in DEBUG_FD deprecation warning in Webstorm Fixes #410

+ Intellij idea

* Hide in DEBUG_FD deprecation warning in Webstorm Fixes #410

* whitelist DEBUG_FD for values 1 and 2 only

* Use appreciate depreciation message
  • Loading branch information
pi0 authored and thebigredgeek committed Jan 24, 2017
1 parent 705a9fe commit 37e14d6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
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(){}, '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 fd = parseInt(process.env.DEBUG_FD, 10) || 2;
var stream = 1 === fd ? process.stdout :
2 === fd ? process.stderr :
createWritableStdioStream(fd);
Expand Down

0 comments on commit 37e14d6

Please sign in to comment.