forked from lix-project/hydra
hydra-eval-jobs: Fix unexpected EOF when a top-level attr fails
This commit is contained in:
parent
a7d8ee98da
commit
107d60027f
|
@ -235,12 +235,13 @@ static void worker(
|
|||
else throw TypeError("attribute '%s' is %s, which is not supported", attrPath, showType(*v));
|
||||
|
||||
} catch (EvalError & e) {
|
||||
auto msg = e.msg();
|
||||
// Transmits the error we got from the previous evaluation
|
||||
// in the JSON output.
|
||||
reply["error"] = filterANSIEscapes(e.msg(), true);
|
||||
reply["error"] = filterANSIEscapes(msg, true);
|
||||
// Don't forget to print it into the STDERR log, this is
|
||||
// what's shown in the Hydra UI.
|
||||
printError("error: %s", reply["error"]);
|
||||
printError(msg);
|
||||
}
|
||||
|
||||
writeLine(to.get(), reply.dump());
|
||||
|
@ -326,13 +327,15 @@ int main(int argc, char * * argv)
|
|||
EvalState state(myArgs.searchPath, openStore());
|
||||
Bindings & autoArgs = *myArgs.getAutoArgs(state);
|
||||
worker(state, autoArgs, *to, *from);
|
||||
} catch (std::exception & e) {
|
||||
} catch (Error & e) {
|
||||
nlohmann::json err;
|
||||
err["error"] = e.what();
|
||||
auto msg = e.msg();
|
||||
err["error"] = filterANSIEscapes(msg, true);
|
||||
printError(msg);
|
||||
writeLine(to->get(), err.dump());
|
||||
// Don't forget to print it into the STDERR log, this is
|
||||
// what's shown in the Hydra UI.
|
||||
printError("error: %s", err["error"]);
|
||||
writeLine(to->get(), "restart");
|
||||
}
|
||||
},
|
||||
ProcessOptions { .allowVfork = false });
|
||||
|
|
Loading…
Reference in a new issue