Commit Graph

5 Commits

Author SHA1 Message Date
Anna Henningsen
072feec1b0 Revert "repl: always check for NODE_REPL_MODE environment variable"
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>
2020-06-25 19:18:55 -07:00
Ruben Bridgewater
b831b081c4
repl: always check for NODE_REPL_MODE environment variable
This makes sure all REPL instances check for the NODE_REPL_MODE
environment variable in case the `replMode` is not passed through
as option.

At the same time this simplifies the internal REPL code significantly.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: https://github.com/nodejs/node/pull/33461
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-06-25 11:54:46 -07:00
Ruben Bridgewater
97737fd5fb
repl: fix terminal default setting
This makes sure that the described default behavior for the
`terminal` option is actually always used and not only when running
the REPL as standalone program.

The options code is now logically combined instead of being spread
out in the big REPL constructor.

PR-URL: https://github.com/nodejs/node/pull/26518
Reviewed-By: Lance Ball <lball@redhat.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-25 16:28:07 +01:00
Ruben Bridgewater
b3e93a91eb
util: do not escape single quotes if not necessary
Right now util.inspect will always escape single quotes. That is not
necessary though in case the string that will be escaped does not
contain double quotes. In that case the string can simply be wrapped
in double quotes instead.
If the string contains single and double quotes and it does not
contain `${` as part of the string, backticks will be used instead.
That makes sure only very few strings have to escape quotes at all.
Thus it increases the readability of these strings.

PR-URL: https://github.com/nodejs/node/pull/21624
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-07-16 14:18:25 +02:00
Ben Noordhuis
727339e9c2
repl: fix util.inspect() coloring regression
The `Object.assign()` calls introduced in commit 90a4390 ("repl: show
proxies as Proxy objects") mutated their first argument, causing the
`{ colors: true }` option from the REPL to leak over into the global
`util.inspect.defaultOptions` object.

Refs: https://github.com/nodejs/node/pull/16485#issuecomment-350428638

PR-URL: https://github.com/nodejs/node/pull/17565
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-12-12 12:49:32 -02:00