Repl: error out if :log is called without a derivation

The repl crashes with an assertion error at lix/libutil/file-system.cc:45
if you run ':log' without any derivation, so I added a check to error out
gracefully

Change-Id: I7af70040f884e905f0514ea9883b2380fe148f15
This commit is contained in:
Toast
2025-03-13 18:24:09 +01:00
parent b1a8c0f2e0
commit 84fbc9d644
+2
View File
@@ -713,6 +713,8 @@ ProcessLineResult NixRepl::processLine(std::string line)
}
else if (command == ":log") {
if (arg.empty())
throw Error("cannot use ':log' without a specifying a derivation");
StorePath drvPath = ([&] {
auto maybeDrvPath = evaluator.store->maybeParseStorePath(arg);
if (maybeDrvPath && maybeDrvPath->isDerivation()) {