aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/repl.cc
diff options
context:
space:
mode:
authorYorick van Pelt <yorick@yorickvanpelt.nl>2023-03-02 17:24:58 +0100
committerYorick van Pelt <yorick@yorickvanpelt.nl>2023-03-02 17:24:58 +0100
commit5bb6e3bfafbcd101962b39ce579ee56d670cd83a (patch)
tree35c22a31cd26c3a63042cb44b5a0fb00dad10b91 /src/libcmd/repl.cc
parent306e5c5ce5a38fecb90b2d2a3c6159fd2ad9c5cc (diff)
NixRepl::mainLoop: restore old curRepl on function exit
This fixes completion callbacks after entering and leaving a nested debugger.
Diffstat (limited to 'src/libcmd/repl.cc')
-rw-r--r--src/libcmd/repl.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc
index e3afb1531..29c838ec0 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);