diff options
author | Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> | 2023-04-04 09:44:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-04 09:44:47 +0200 |
commit | d93c1514ebcf71390c8a8070759487e5a40dcc6f (patch) | |
tree | 68f6b052cee118b63a5f3e4a2971b5bc75ef0a19 /src/libcmd/repl.cc | |
parent | 523c3f722564f92e6dd7cd6256474c6d23db11b4 (diff) | |
parent | 5bb6e3bfafbcd101962b39ce579ee56d670cd83a (diff) |
Merge pull request #7944 from yorickvP/fix-curRepl
NixRepl::mainLoop: restore old curRepl on function exit
Diffstat (limited to 'src/libcmd/repl.cc')
-rw-r--r-- | src/libcmd/repl.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index e75ac2cf4..57848a5d3 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -252,7 +252,9 @@ void NixRepl::mainLoop() el_hist_size = 1000; #endif read_history(historyFile.c_str()); + auto oldRepl = curRepl; curRepl = this; + Finally restoreRepl([&] { curRepl = oldRepl; }); #ifndef READLINE rl_set_complete_func(completionCallback); rl_set_list_possib_func(listPossibleCallback); |