aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/sandbox.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/sandbox.js b/test/sandbox.js
index 5fe0a02d..8f5d04da 100644
--- a/test/sandbox.js
+++ b/test/sandbox.js
@@ -1,9 +1,15 @@
+var readFileSync = require("fs").readFileSync;
var semver = require("semver");
var spawnSync = require("child_process").spawnSync;
var vm = require("vm");
setup_log();
-var setup_code = "(" + setup + ")(this, " + setup_log + ", " + find_builtins() + ");";
+var setup_code = "(" + setup + ")(" + [
+ "this",
+ find_builtins(),
+ setup_log,
+ "function(process) {" + readFileSync(require.resolve("../tools/tty", "utf8")) + "}",
+].join(",\n") + ");\n";
exports.has_toplevel = function(options) {
return options.toplevel
|| options.mangle && options.mangle.toplevel
@@ -77,7 +83,7 @@ function find_builtins() {
return builtins;
}
-function setup(global, setup_log, builtins) {
+function setup(global, builtins, setup_log, setup_tty) {
[ Array, Boolean, Error, Function, Number, Object, RegExp, String ].forEach(function(f) {
f.toString = Function.prototype.toString;
});
@@ -99,6 +105,7 @@ function setup(global, setup_log, builtins) {
}();
var process = global.process;
if (process) {
+ setup_tty(process);
var inspect = setup_log();
process.on("uncaughtException", function(ex) {
var value = ex;