Description
- Version: 10.15.0
- Platform: Windows 10 x64 (1809)
- Subsystem: REPL (
lib/internal/repl.js
)
Per the REPL documentation the history file path can be changed by setting the NODE_REPL_HISTORY
environment variable to a valid path or disabled by setting it to the empty string.
On Windows platforms an empty environment variable is difficult to set. From my own testing:
- A variable cannot be saved with a blank value via the System Properties UI (
sysdm.cpl
). - Setting the value to
''
or""
will set it to a literal two single quotes or double quotes when using the System Properties UI. - Setting the value to
''
will set it to a literal two single quotes when using thesetx
Command Prompt utility. - The .NET Environment.SetEnvironmentVariable method notes that an empty variable value will result in the variable being deleted if it exists or a no-op if it doesn't.
I've found that a blank variable can be set using setx
with two double quotes: setx NODE_REPL_HISTORY ""
. I haven't tried calling the underlying Win32 SetEnvironmentVariable function directly but given the behaviour of setx
it presumably would work.
It seems clear to me that setting blank environment variables is discouraged and the support for doing so is patchy at best. This being the case, it would be desirable to support an alternate value that's legal on Windows to indicate that the REPL history should not be saved. One possible option would be recognising the value ''
(i.e. two single quotes) which in my view is the most intuitive setting, but there's of course other options.
Thoughts?