diff options
-rw-r--r-- | bbot/agent.cxx | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/bbot/agent.cxx b/bbot/agent.cxx index eed49d6..b2beed8 100644 --- a/bbot/agent.cxx +++ b/bbot/agent.cxx @@ -596,7 +596,7 @@ perform_task (const dir_path& md, try {m->forcedown ();} catch (const failed&) {} })); - auto soft_fail = [&xp, &m, &r] (const char* msg) + auto soft_fail = [&xp, &m, &r] (const char* msg, bool wait = true) { { diag_record dr (error); @@ -604,7 +604,10 @@ perform_task (const dir_path& md, m->print_info (dr); } m->suspend (); - m->wait (); + + if (wait) + m->wait (); + return r; }; @@ -633,6 +636,26 @@ perform_task (const dir_path& md, l3 ([&]{trace << "completed build in " << build_to - to << "s";}); + // Parse the result manifest. + // + r = parse_manifest<result_manifest> (rf, "result"); + + // Update package name/version if the returned value as "unknown". + // + if (r.version == bpkg::version ("0")) + { + assert (r.status == result_status::abnormal); + + r.name = tm.name; + r.version = tm.version; + } + + // If the build terminated abnormally, suspent the machine for + // investigation (note that here we don't wait or return). + // + if (r.status == result_status::abnormal) + soft_fail ("build terminated abnormally", false); + // Force the machine down (there is no need wasting time on clean // shutdown since the next step is to drop the snapshot). // @@ -640,20 +663,6 @@ perform_task (const dir_path& md, } run_btrfs (trace, "subvolume", "delete", xp); - - // Parse the result manifest. - // - r = parse_manifest<result_manifest> (rf, "result"); - - // Update package name/version if the returned value as "unknown". - // - if (r.version == bpkg::version ("0")) - { - assert (r.status == result_status::abnormal); - - r.name = tm.name; - r.version = tm.version; - } } catch (const system_error& e) { |