mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-14 02:06:16 +02:00
clear screen and show top debug trace
This commit is contained in:
parent
a963674d88
commit
990bec78d3
1 changed files with 22 additions and 0 deletions
|
@ -77,8 +77,30 @@ ref<EvalState> EvalCommand::getEvalState()
|
||||||
searchPath, getEvalStore(), getStore());
|
searchPath, getEvalStore(), getStore());
|
||||||
if (startReplOnEvalErrors)
|
if (startReplOnEvalErrors)
|
||||||
debuggerHook = [evalState{ref<EvalState>(evalState)}](const Error * error, const Env & env, const Expr & expr) {
|
debuggerHook = [evalState{ref<EvalState>(evalState)}](const Error * error, const Env & env, const Expr & expr) {
|
||||||
|
std::cout << "\033[2J\033[1;1H";
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error->what());
|
printError("%s\n\n" ANSI_BOLD "Starting REPL to allow you to inspect the current state of the evaluator.\n" ANSI_NORMAL, error->what());
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto iter = evalState->debugTraces.begin();
|
||||||
|
if (iter != evalState->debugTraces.end()) {
|
||||||
|
std::cout << "\n" << "… " << iter->hint.str() << "\n";
|
||||||
|
|
||||||
|
if (iter->pos.has_value() && (*iter->pos)) {
|
||||||
|
auto pos = iter->pos.value();
|
||||||
|
std::cout << "\n";
|
||||||
|
printAtPos(pos, std::cout);
|
||||||
|
|
||||||
|
auto loc = getCodeLines(pos);
|
||||||
|
if (loc.has_value()) {
|
||||||
|
std::cout << "\n";
|
||||||
|
printCodeLines(std::cout, "", pos, *loc);
|
||||||
|
std::cout << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (expr.staticenv)
|
if (expr.staticenv)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue