repl-interacter: save history after entering every line
Fixes: lix-project/lix#328
Change-Id: Iedd79ff5f72e84766ebd234c63856170afc624f0
This commit is contained in:
parent
40311973a8
commit
bfb91db4f6
9
doc/manual/rl-next/repl-fix-history.md
Normal file
9
doc/manual/rl-next/repl-fix-history.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
synopsis: "`nix repl` history is saved more reliably"
|
||||
cls: 1164
|
||||
credits: puck
|
||||
---
|
||||
|
||||
`nix repl` now saves its history file after each line, rather than at the end
|
||||
of the session; ensuring that it will remember what you typed even after it
|
||||
crashes.
|
|
@ -175,6 +175,8 @@ bool ReadlineLikeInteracter::getLine(std::string & input, ReplPromptType promptT
|
|||
|
||||
if (!s)
|
||||
return false;
|
||||
|
||||
write_history(historyFile.c_str());
|
||||
input += s;
|
||||
input += '\n';
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue