diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-10-14 09:29:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-14 09:29:31 +0200 |
commit | 8196d4f4e94407396b4ba37bd89c91ad0d4062f0 (patch) | |
tree | ce4338015d10ddf22afc74dbb7ddb281245e15d2 | |
parent | 27ed3d04581b39b2653a50c0251b3d82fdade6f3 (diff) | |
parent | 0359d6d12314e46e45f16cccca7e0b38046d2e1c (diff) |
Merge pull request #7169 from edolstra/fix-execve-error-msg
Fix error display if execve() in the builder fails
-rw-r--r-- | src/libstore/build/local-derivation-goal.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc index 18b682e13..5cea3b590 100644 --- a/src/libstore/build/local-derivation-goal.cc +++ b/src/libstore/build/local-derivation-goal.cc @@ -1594,6 +1594,8 @@ void LocalDerivationGoal::runChild() /* Warning: in the child we should absolutely not make any SQLite calls! */ + bool sendException = true; + try { /* child */ commonChildInit(builderOut); @@ -2050,6 +2052,8 @@ void LocalDerivationGoal::runChild() /* Indicate that we managed to set up the build environment. */ writeFull(STDERR_FILENO, std::string("\2\n")); + sendException = false; + /* Execute the program. This should not return. */ if (drv->isBuiltin()) { try { @@ -2103,10 +2107,13 @@ void LocalDerivationGoal::runChild() throw SysError("executing '%1%'", drv->builder); } catch (Error & e) { - writeFull(STDERR_FILENO, "\1\n"); - FdSink sink(STDERR_FILENO); - sink << e; - sink.flush(); + if (sendException) { + writeFull(STDERR_FILENO, "\1\n"); + FdSink sink(STDERR_FILENO); + sink << e; + sink.flush(); + } else + std::cerr << e.msg(); _exit(1); } } |