print error if worker receives invalid command

This commit is contained in:
Jörg Thalheim 2023-12-10 08:55:56 +01:00 committed by mergify[bot]
parent 93972c0c18
commit 00d3f014e7

View file

@ -366,10 +366,14 @@ static void worker(ref<EvalState> state, Bindings &autoArgs, AutoCloseFD &to,
} }
auto s = fromReader.readLine(); auto s = fromReader.readLine();
if (s == "exit") if (s == "exit") {
break; break;
if (!hasPrefix(s, "do ")) }
if (!hasPrefix(s, "do ")) {
fprintf(stderr, "worker error: received invalid command '%s'\n",
s.data());
abort(); abort();
}
auto path = json::parse(s.substr(3)); auto path = json::parse(s.substr(3));
auto attrPathS = attrPathJoin(path); auto attrPathS = attrPathJoin(path);