diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js index fb8bc762286467..bb7de659db4a4f 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -593,7 +593,7 @@ }; NativeModule.wrapper = [ - '(function (exports, require, module, internalBinding) {', + '(function (exports, require, module, internalBinding, process) {', '\n});' ]; @@ -612,7 +612,7 @@ const requireFn = this.id.startsWith('internal/deps/') ? NativeModule.requireForDeps : NativeModule.require; - fn(this.exports, requireFn, this, internalBinding); + fn(this.exports, requireFn, this, internalBinding, process); this.loaded = true; } finally { diff --git a/test/parallel/test-repl-let-process.js b/test/parallel/test-repl-let-process.js new file mode 100644 index 00000000000000..3e6c3e85665be1 --- /dev/null +++ b/test/parallel/test-repl-let-process.js @@ -0,0 +1,10 @@ +'use strict'; +const common = require('../common'); +const repl = require('repl'); + +common.globalCheck = false; + +// Regression test for https://github.com/nodejs/node/issues/6802 +const input = new common.ArrayStream(); +repl.start({ input, output: process.stdout, useGlobal: true }); +input.run(['let process']);