Skip to content
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

REPL fails on startup on Windows machines. #112

Open
JordanRickman opened this issue Oct 18, 2020 · 0 comments
Open

REPL fails on startup on Windows machines. #112

JordanRickman opened this issue Oct 18, 2020 · 0 comments

Comments

@JordanRickman
Copy link

On startup, the REPL looks for its history file at .sibilant.history in the user's home directory. See repl.sibilant line 12: (var ... HISTORY-FILE (|> process.env.SIBILANT-REPL-HISTORY-FILE (or (""process.env.HOME"/.sibilant.history")))

However, on Windows machine this may fail because process.env.HOME is not set by default. Windows does not set this environment variable unless the user explicitly does so, using the environment variable USERPROFILE instead. This results in an error like the following:

Error: ENOENT: no such file or directory, open 'undefined/.sibilant.history'
    at Object.openSync (fs.js:462:3)
    at Object.<anonymous> (C:\<redacted>\stitch-sibilant-challenge\node_modules\sibilant\maps\src\repl.sibilant:26:12)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.cli$repl$ [as repl] (C:\<redacted>\node_modules\sibilant\maps\src\cli.sibilant:37:7)
    at Object.<anonymous> (C:\<redacted>\node_modules\sibilant\maps\src\cli.sibilant:78:8)

A better approach would be to use Node's os.homedir() instead of process.env, as os.homedir() is more reliable across multiple OSes and environments.

@JordanRickman JordanRickman changed the title Use os.homedir() instead of process.env.HOME in REPL. REPL fails on startup on Windows machines. Oct 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant