From 5bb6e3bfafbcd101962b39ce579ee56d670cd83a Mon Sep 17 00:00:00 2001 From: Yorick van Pelt Date: Thu, 2 Mar 2023 17:24:58 +0100 Subject: [PATCH] NixRepl::mainLoop: restore old curRepl on function exit This fixes completion callbacks after entering and leaving a nested debugger. --- src/libcmd/repl.cc | 2 ++ 1 file changed, 2 insertions(+) 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);