Fix fatal "broken pipe" error when $NIX_BUILD_HOOK is missing
This commit is contained in:
parent
ffcf9d24a6
commit
2f992692e2
|
@ -1580,6 +1580,8 @@ HookReply DerivationGoal::tryBuildHook()
|
|||
if (!worker.hook)
|
||||
worker.hook = std::make_unique<HookInstance>();
|
||||
|
||||
try {
|
||||
|
||||
/* Tell the hook about system features (beyond the system type)
|
||||
required from the build machine. (The hook could parse the
|
||||
drv file itself, but this is easier.) */
|
||||
|
@ -1611,6 +1613,16 @@ HookReply DerivationGoal::tryBuildHook()
|
|||
else if (reply != "accept")
|
||||
throw Error(format("bad hook reply ‘%1%’") % reply);
|
||||
|
||||
} catch (SysError & e) {
|
||||
if (e.errNo == EPIPE) {
|
||||
printError("build hook died unexpectedly: %s",
|
||||
chomp(drainFD(worker.hook->fromHook.readSide.get())));
|
||||
worker.hook = 0;
|
||||
return rpDecline;
|
||||
} else
|
||||
throw;
|
||||
}
|
||||
|
||||
printMsg(lvlTalkative, format("using hook to build path(s) %1%") % showPaths(missingPaths));
|
||||
|
||||
hook = std::move(worker.hook);
|
||||
|
|
Loading…
Reference in a new issue