diff options
-rw-r--r-- | bbot/worker/worker.cxx | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx index 5a4d240..056f391 100644 --- a/bbot/worker/worker.cxx +++ b/bbot/worker/worker.cxx @@ -1339,6 +1339,7 @@ static const string worker_checksum ("5"); // Logic version. static int bbot:: build (size_t argc, const char* argv[]) +try { using std::map; using std::multimap; @@ -6348,7 +6349,7 @@ build (size_t argc, const char* argv[]) } break; - } + } // End "breakout" loop. if (!rm.results.empty ()) { @@ -6419,7 +6420,7 @@ build (size_t argc, const char* argv[]) assert (rm.status == result_status::abort || rm.status == result_status::skip); - if (!rwd.empty ()) + if (!rwd.empty ()) // @@ When can it be empty? { change_wd (trace, nullptr /* log */, rwd); @@ -6470,7 +6471,7 @@ build (size_t argc, const char* argv[]) } // // We use exit code 3 to signal an unsuccessful attempt to upload the result - // manifest and exit code 4 to singal that there was no disk space to + // manifest and exit code 4 to signal that there was no disk space to // serialize the manifest. See startup() for details. // catch (const io_error& e) @@ -6483,10 +6484,42 @@ build (size_t argc, const char* argv[]) assert (e.code ().category () == std::generic_category () && e.code ().value () == ENOSPC); - error << "unable to serialize result manifest: " << e; + try + { + error << "unable to serialize result manifest: " << e; + } + catch (...) {} + return 4; } } +catch (const system_error& e) +{ + // This can be, for example, io_error due to the inability to flush the + // logs. + // + if (e.code ().category () == std::generic_category () && + e.code ().value () == ENOSPC) + { + try + { + error << "no space left on device"; + } + catch (...) {} + + return 4; + } + else + { + error << "unexpected system error: " << e; + return 1; // Abnormal, no result manifest uploaded. + } +} +catch (const std::exception& e) +{ + error << "unexpected error: " << e; + return 1; // Abnormal, no result manifest uploaded. +} // Parse the task_manifest::auxiliary_environment value into the list of // environment variable assignments as expected by the process API. Throw @@ -6801,6 +6834,9 @@ startup () // Exit code 4 signals the inability to serialize the result manifest due // to insufficient disk space. // + // Note that in case of abnormal termination, run_io_exit() throws failed + // which is handled the same as exit code 1. + // switch (run_io_exit (trace, 0 /* stdin */, 2 /* stdout */, 2 /* stderr */, process_env (pp, aux_env), |