mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
This reverts commit b831b081c4.
This presumably unbreaks the ASAN github action build.
Example failure:
2020-06-25T19:59:15.1448178Z === release test-repl-envvars ===
2020-06-25T19:59:15.1448872Z Path: parallel/test-repl-envvars
2020-06-25T19:59:15.1449449Z --- stderr ---
2020-06-25T19:59:15.1449835Z assert.js:103
2020-06-25T19:59:15.1450194Z throw new AssertionError(obj);
2020-06-25T19:59:15.1450524Z ^
2020-06-25T19:59:15.1450817Z
2020-06-25T19:59:15.1451431Z AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
2020-06-25T19:59:15.1452000Z + actual - expected
2020-06-25T19:59:15.1452298Z
2020-06-25T19:59:15.1452634Z {
2020-06-25T19:59:15.1452978Z terminal: true,
2020-06-25T19:59:15.1453321Z + useColors: false
2020-06-25T19:59:15.1453861Z - useColors: true
2020-06-25T19:59:15.1454225Z }
2020-06-25T19:59:15.1454841Z at /home/runner/work/node/node/test/parallel/test-repl-envvars.js:55:12
2020-06-25T19:59:15.1455246Z at internal/repl.js:33:5
PR-URL: https://github.com/nodejs/node/pull/34058
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
'use strict';
|
|
|
|
const {
|
|
Number,
|
|
NumberIsNaN,
|
|
ObjectCreate,
|
|
} = primordials;
|
|
|
|
const REPL = require('repl');
|
|
const { kStandaloneREPL } = require('internal/repl/utils');
|
|
|
|
module.exports = ObjectCreate(REPL);
|
|
module.exports.createInternalRepl = createRepl;
|
|
|
|
function createRepl(env, opts, cb) {
|
|
if (typeof opts === 'function') {
|
|
cb = opts;
|
|
opts = null;
|
|
}
|
|
opts = {
|
|
[kStandaloneREPL]: true,
|
|
ignoreUndefined: false,
|
|
useGlobal: true,
|
|
breakEvalOnSigint: true,
|
|
...opts
|
|
};
|
|
|
|
if (parseInt(env.NODE_NO_READLINE)) {
|
|
opts.terminal = false;
|
|
}
|
|
|
|
if (env.NODE_REPL_MODE) {
|
|
opts.replMode = {
|
|
'strict': REPL.REPL_MODE_STRICT,
|
|
'sloppy': REPL.REPL_MODE_SLOPPY
|
|
}[env.NODE_REPL_MODE.toLowerCase().trim()];
|
|
}
|
|
|
|
if (opts.replMode === undefined) {
|
|
opts.replMode = REPL.REPL_MODE_SLOPPY;
|
|
}
|
|
|
|
const historySize = Number(env.NODE_REPL_HISTORY_SIZE);
|
|
if (!NumberIsNaN(historySize) && historySize > 0) {
|
|
opts.historySize = historySize;
|
|
} else {
|
|
opts.historySize = 1000;
|
|
}
|
|
|
|
const repl = REPL.start(opts);
|
|
const term = 'terminal' in opts ? opts.terminal : process.stdout.isTTY;
|
|
repl.setupHistory(term ? env.NODE_REPL_HISTORY : '', cb);
|
|
}
|