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

.setupHistory() for non-terminal REPL fails #36773

Closed
addaleax opened this issue Jan 4, 2021 · 0 comments · Fixed by #36774
Closed

.setupHistory() for non-terminal REPL fails #36773

addaleax opened this issue Jan 4, 2021 · 0 comments · Fixed by #36774
Labels
repl Issues and PRs related to the REPL subsystem.

Comments

@addaleax
Copy link
Member

addaleax commented Jan 4, 2021

  • Version: master
  • Platform: Ubuntu 20.04
  • Subsystem: repl

What steps will reproduce the bug?

'use strict';
const repl = require('repl');
const r = repl.start({ terminal: false });
r.setupHistory('/nonexistent/file', (err) => console.log(err));

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

No error (beyond the warning message)

What do you see instead?

$ node repltest.js 
> 
Error: Could not open history file.
REPL session history will not be persisted.
node:readline:794
                          StringPrototypeSlice(this.line, 0, this.cursor);
                          ^

TypeError: String.prototype.slice called on null or undefined
    at slice (<anonymous>)
    at REPLServer.Interface.getCursorPos (node:readline:794:27)
    at REPLServer.Interface._refreshLine (node:readline:419:26)
    at _writeToOutput (node:internal/repl/history:30:8)
    at oninit (node:internal/repl/history:69:7)
    at FSReqCallback.oncomplete (node:fs:184:23)
    at FSReqCallback.callbackTrampoline (node:internal/async_hooks:131:14)
@addaleax addaleax added the repl Issues and PRs related to the REPL subsystem. label Jan 4, 2021
@aduh95 aduh95 closed this as completed in fffdaeb Jan 6, 2021
danielleadams pushed a commit that referenced this issue Jan 12, 2021
Fixes: #36773

PR-URL: #36774
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos pushed a commit that referenced this issue May 1, 2021
Fixes: #36773

PR-URL: #36774
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant