diff options
author | Tom Bereknyei <tomberek@gmail.com> | 2022-06-02 16:34:27 -0400 |
---|---|---|
committer | Tom Bereknyei <tomberek@gmail.com> | 2022-06-02 16:58:35 -0400 |
commit | ffd41d17571478083666cc07764011c97c39b21c (patch) | |
tree | 37d0b6284c7a9df4a91204778bd7ee894eddc011 /src/libcmd/command.cc | |
parent | 8c3939af14106c753bbb963663ad1cfb4fa6de80 (diff) | |
parent | 1892355766af57868f74a9efd75aa279b29a04f6 (diff) |
Merge branch 'master' into nix-repl-flakes
Diffstat (limited to 'src/libcmd/command.cc')
-rw-r--r-- | src/libcmd/command.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index f28cfe5de..7f8072d75 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -86,6 +86,11 @@ ref<Store> CopyCommand::getDstStore() EvalCommand::EvalCommand() { + addFlag({ + .longName = "debugger", + .description = "start an interactive environment if evaluation fails", + .handler = {&startReplOnEvalErrors, true}, + }); } EvalCommand::~EvalCommand() @@ -103,7 +108,7 @@ ref<Store> EvalCommand::getEvalStore() ref<EvalState> EvalCommand::getEvalState() { - if (!evalState) + if (!evalState) { evalState = #if HAVE_BOEHMGC std::allocate_shared<EvalState>(traceable_allocator<EvalState>(), @@ -113,6 +118,11 @@ ref<EvalState> EvalCommand::getEvalState() searchPath, getEvalStore(), getStore()) #endif ; + + if (startReplOnEvalErrors) { + evalState->debugRepl = &runRepl; + }; + } return ref<EvalState>(evalState); } |