mirror of
https://github.com/NixOS/nix
synced 2025-06-28 22:01:15 +02:00
quit repl from step mode
This commit is contained in:
parent
e761bf0601
commit
c9bc3735f6
4 changed files with 26 additions and 7 deletions
|
@ -438,6 +438,7 @@ EvalState::EvalState(
|
|||
, store(store)
|
||||
, buildStore(buildStore ? buildStore : store)
|
||||
, debugStop(false)
|
||||
, debugQuit(false)
|
||||
, regexCache(makeRegexCache())
|
||||
#if HAVE_BOEHMGC
|
||||
, valueAllocCache(std::allocate_shared<void *>(traceable_allocator<void *>(), nullptr))
|
||||
|
|
|
@ -116,6 +116,7 @@ public:
|
|||
RootValue vImportedDrvToDerivation = nullptr;
|
||||
|
||||
bool debugStop;
|
||||
bool debugQuit;
|
||||
std::list<DebugTrace> debugTraces;
|
||||
|
||||
void debug_throw(Error e);
|
||||
|
|
|
@ -718,6 +718,15 @@ static RegisterPrimOp primop_break({
|
|||
auto &dt = state.debugTraces.front();
|
||||
debuggerHook(&error, dt.env, dt.expr);
|
||||
|
||||
if (state.debugQuit) {
|
||||
// if the user elects to quit the repl, throw an exception.
|
||||
throw Error(ErrorInfo{
|
||||
.level = lvlInfo,
|
||||
.msg = hintfmt("quit from debugger"),
|
||||
.errPos = pos,
|
||||
});
|
||||
}
|
||||
|
||||
// returning the value we were passed.
|
||||
v = *args[0];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue