aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-02-05 12:11:50 +0100
committerEelco Dolstra <edolstra@gmail.com>2021-02-05 12:18:11 +0100
commit0187838e2e7ff01f1b480e3e85d9e96da0b4b78e (patch)
tree3f26b4f9f0fea5ea44dba0967c40510c5cfb230e /src
parenta487d421019bc16d83dad66b805b550cb6b70272 (diff)
Add a trace to readLine() failures
Hopefully this helps to diagnose 'error: unexpected EOF reading a line' on macOS.
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build/derivation-goal.cc25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc
index 8717499c0..190adf31c 100644
--- a/src/libstore/build/derivation-goal.cc
+++ b/src/libstore/build/derivation-goal.cc
@@ -1044,7 +1044,14 @@ HookReply DerivationGoal::tryBuildHook()
whether the hook wishes to perform the build. */
string reply;
while (true) {
- string s = readLine(worker.hook->fromHook.readSide.get());
+ auto s = [&]() {
+ try {
+ return readLine(worker.hook->fromHook.readSide.get());
+ } catch (Error & e) {
+ e.addTrace({}, "while reading the response from the build hook");
+ throw e;
+ }
+ }();
if (handleJSONLogMessage(s, worker.act, worker.hook->activities, true))
;
else if (string(s, 0, 2) == "# ") {
@@ -1084,7 +1091,12 @@ HookReply DerivationGoal::tryBuildHook()
hook = std::move(worker.hook);
- machineName = readLine(hook->fromHook.readSide.get());
+ try {
+ machineName = readLine(hook->fromHook.readSide.get());
+ } catch (Error & e) {
+ e.addTrace({}, "while reading the machine name from the build hook");
+ throw e;
+ }
/* Tell the hook all the inputs that have to be copied to the
remote system. */
@@ -1773,7 +1785,14 @@ void DerivationGoal::startBuilder()
/* Check if setting up the build environment failed. */
while (true) {
- string msg = readLine(builderOut.readSide.get());
+ string msg = [&]() {
+ try {
+ return readLine(builderOut.readSide.get());
+ } catch (Error & e) {
+ e.addTrace({}, "while reading the response of setting up the build environment");
+ throw e;
+ }
+ }();
if (string(msg, 0, 1) == "\2") break;
if (string(msg, 0, 1) == "\1") {
FdSource source(builderOut.readSide.get());