diff options
author | Mihai Bazon <mihai@bazon.net> | 2012-10-20 11:12:21 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2012-10-20 11:12:21 +0300 |
commit | 12f71e01d02a2f4cc76cb8471036992e0cba9cf1 (patch) | |
tree | aa66959fe7edec7cbd29cfd85015903a17f47a1d /tools | |
parent | fc8314e810c91431cd18fa9a784adb7867726013 (diff) | |
download | tracifyjs-12f71e01d02a2f4cc76cb8471036992e0cba9cf1.tar.gz tracifyjs-12f71e01d02a2f4cc76cb8471036992e0cba9cf1.zip |
alternate hack to disable deprecation warning
ref #9, close #20
Diffstat (limited to 'tools')
-rw-r--r-- | tools/node.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/tools/node.js b/tools/node.js index 6a21710a..86df2a9f 100644 --- a/tools/node.js +++ b/tools/node.js @@ -1,27 +1,25 @@ -var save_stderr = process.stderr; +var path = require("path"); var fs = require("fs"); -// discard annoying NodeJS warning ("path.existsSync is now called `fs.existsSync`.") -var devnull = fs.createWriteStream("/dev/null"); -process.__defineGetter__("stderr", function(){ - return devnull; -}); +// Avoid NodeJS warning. +// +// There's a --no-deprecation command line argument supported by +// NodeJS, but that's tricky to use, so I'd like to set it from the +// program itself. Turns out you need to set `process.noDeprecation`, +// but by the time you can set that the `path` module is already +// loaded and `path.existsSync` is already changed to display that +// warning, therefore here's the poor solution: +path.existsSync = fs.existsSync; var vm = require("vm"); var sys = require("util"); -var path = require("path"); var UglifyJS = vm.createContext({ sys : sys, console : console, - MOZ_SourceMap : require("source-map") }); -process.__defineGetter__("stderr", function(){ - return save_stderr; -}); - function load_global(file) { file = path.resolve(path.dirname(module.filename), file); try { |