-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to disable REPL history on Windows #25661
Comments
I spoke too soon, the The blank variable can be seen in the System Properties UI, presumably because it enumerates them from the Registry rather than its process environment, but it can only be deleted or a value set. So as it stands it seems disabling the REPL history is not possible on Windows until an alternate non-blank value is recognised for the |
Try |
@ralish setting the environment variable to an empty string or a string that contains only whitespace should work just fine (as documented). I guess the latter should work even if Windows does not recognize empty strings. |
Sigh, my bad, missed a space: " |
@bzoz: You're right, this does work, thanks! Can I suggest at least a documentation update to make it a bit more explicit that on Windows one or more space characters should be used? Right now it's implied on closer reading with the whitespace trimming, but making it concrete would I think be helpful as the empty string is not valid on Windows. |
@ralish please feel encouraged to open a pull request to improve the wording :-) |
Environment variables with empty values are not permitted on Windows. As such, to disable persistent REPL history one or more spaces should be used. Node will trim whitespace from the variable, resulting in a blank variable at runtime and the desired behaviour. PR-URL: #25672 Fixes: #25661 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Environment variables with empty values are not permitted on Windows. As such, to disable persistent REPL history one or more spaces should be used. Node will trim whitespace from the variable, resulting in a blank variable at runtime and the desired behaviour. PR-URL: #25672 Fixes: #25661 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Environment variables with empty values are not permitted on Windows. As such, to disable persistent REPL history one or more spaces should be used. Node will trim whitespace from the variable, resulting in a blank variable at runtime and the desired behaviour. PR-URL: #25672 Fixes: #25661 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Environment variables with empty values are not permitted on Windows. As such, to disable persistent REPL history one or more spaces should be used. Node will trim whitespace from the variable, resulting in a blank variable at runtime and the desired behaviour. PR-URL: #25672 Fixes: #25661 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
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:
sysdm.cpl
).''
or""
will set it to a literal two single quotes or double quotes when using the System Properties UI.''
will set it to a literal two single quotes when using thesetx
Command Prompt utility.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 ofsetx
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?
The text was updated successfully, but these errors were encountered: