Skip to content

Unable to disable REPL history on Windows #25661

Closed
@ralish

Description

@ralish
  • 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 the setx 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.replIssues and PRs related to the REPL subsystem.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions