From af43a575f81e38f3d3b53935036423de29989803 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sun, 5 Jun 2016 15:49:07 -0700 Subject: [PATCH] Undefine global `process` Node specific global should be normalized across environments --- lib/execjs/support/node_runner.js | 2 +- test/test_execjs.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/execjs/support/node_runner.js b/lib/execjs/support/node_runner.js index ab0c6ec..3dc4757 100644 --- a/lib/execjs/support/node_runner.js +++ b/lib/execjs/support/node_runner.js @@ -1,4 +1,4 @@ -(function(program, execJS) { execJS(program) })(function(global, module, exports, require, console, setTimeout, setInterval, clearTimeout, clearInterval, setImmediate, clearImmediate) { #{source} +(function(program, execJS) { execJS(program) })(function(global, process, module, exports, require, console, setTimeout, setInterval, clearTimeout, clearInterval, setImmediate, clearImmediate) { #{source} }, function(program) { var output, print = function(string) { process.stdout.write('' + string); diff --git a/test/test_execjs.rb b/test/test_execjs.rb index 7fd967f..061be48 100644 --- a/test/test_execjs.rb +++ b/test/test_execjs.rb @@ -237,6 +237,10 @@ class TestExecJS < Test assert ExecJS.eval("typeof global == 'undefined'") end + def test_node_process_is_undefined + assert ExecJS.eval("typeof process == 'undefined'") + end + def test_commonjs_vars_are_undefined assert ExecJS.eval("typeof module == 'undefined'") assert ExecJS.eval("typeof exports == 'undefined'")