1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

print message with exceptions in a try clause

This commit is contained in:
Ben Burdette 2022-06-02 12:17:28 -06:00
parent 9151dbff88
commit bc0d41e9ba
3 changed files with 22 additions and 6 deletions

View file

@ -853,11 +853,15 @@ static void prim_tryEval(EvalState & state, const PosIdx pos, Value * * args, Va
auto attrs = state.buildBindings(2);
void (* savedDebugRepl)(ref<EvalState> es, const ValMap & extraEnv) = nullptr;
if (state.debugRepl && state.ignoreTry)
if (state.debugRepl)
{
// to prevent starting the repl from exceptions withing a tryEval, null it.
savedDebugRepl = state.debugRepl;
state.debugRepl = nullptr;
state.trylevel++;
if (state.ignoreTry)
{
// to prevent starting the repl from exceptions withing a tryEval, null it.
savedDebugRepl = state.debugRepl;
state.debugRepl = nullptr;
}
}
try {
@ -873,6 +877,9 @@ static void prim_tryEval(EvalState & state, const PosIdx pos, Value * * args, Va
if (savedDebugRepl)
state.debugRepl = savedDebugRepl;
if (state.debugRepl)
state.trylevel--;
v.mkAttrs(attrs);
}