diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js index 85d72f876124fa..b10b8fe54cf1ef 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -634,7 +634,7 @@ }; NativeModule.wrapper = [ - '(function (exports, require, module, internalBinding) {', + '(function (exports, require, module, internalBinding, process) {', '\n});' ]; @@ -650,7 +650,7 @@ lineOffset: 0, displayErrors: true }); - fn(this.exports, NativeModule.require, this, internalBinding); + fn(this.exports, NativeModule.require, 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']);