diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-05-01 11:53:04 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-05-01 11:53:04 +0200 |
commit | 8b896055d4d90b538211784cf9ad1bf335b20dc6 (patch) | |
tree | 755ca33df640a4a29e1d00c7e2e0265a4243bb94 /bbot/utility.txx | |
parent | c06600bc5e24389453d9a486c69d9746ae4fef23 (diff) |
Soft-fail on VM forcedown failures
Since we've got the result this should be harmless. And should help with
spurious KVM crashes with Mac OS guest.
Diffstat (limited to 'bbot/utility.txx')
-rw-r--r-- | bbot/utility.txx | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/bbot/utility.txx b/bbot/utility.txx index c35db33..519762b 100644 --- a/bbot/utility.txx +++ b/bbot/utility.txx @@ -44,7 +44,7 @@ namespace bbot template <typename P> process_exit::code_type - run_io_finish_exit (tracer&, process& pr, const P& p) + run_io_finish_exit (tracer&, process& pr, const P& p, bool fh) { try { @@ -55,21 +55,32 @@ namespace bbot if (e.normal ()) return e.code (); - fail << "process " << p << " terminated abnormally: " - << e.description () << (e.core () ? " (core dumped)" : "") << endf; + diag_record dr; if (fh) dr << fail; else dr << error; + dr << "process " << p << " terminated abnormally: " + << e.description () << (e.core () ? " (core dumped)" : ""); } catch (const process_error& e) { - fail << "unable to execute " << p << ": " << e << endf; + diag_record dr; if (fh) dr << fail; else dr << error; + dr << "unable to execute " << p << ": " << e; } + + throw failed (); } template <typename P> inline void - run_io_finish (tracer& t, process& pr, const P& p) + run_io_finish (tracer& t, process& pr, const P& p, bool fh) { - if (run_io_finish_exit (t, pr, p) != 0) - fail << "process " << p << " terminated with non-zero exit code"; + if (run_io_finish_exit (t, pr, p, fh) == 0) + return; + + { + diag_record dr; if (fh) dr << fail; else dr << error; + dr << "process " << p << " terminated with non-zero exit code"; + } + + throw failed (); } template <typename I, typename O, typename E, typename P, typename... A> @@ -171,7 +182,7 @@ namespace bbot parse_manifest (istream& is, const string& name, const char* what, - bool hard, + bool fh, bool ignore_unknown) { using namespace butl; @@ -183,14 +194,14 @@ namespace bbot } catch (const manifest_parsing& e) { - diag_record dr; if (hard) dr << fail; else dr << error; + diag_record dr; if (fh) dr << fail; else dr << error; dr << "invalid " << what << " manifest: " << name << ':' << e.line << ':' << e.column << ": " << e.description; } catch (const io_error& e) { - diag_record dr; if (hard) dr << fail; else dr << error; + diag_record dr; if (fh) dr << fail; else dr << error; dr << "unable to read " << what << " manifest " << name << ": " << e; } @@ -227,7 +238,7 @@ namespace bbot ostream& os, const string& name, const char* what, - bool hard) + bool fh) { using namespace butl; @@ -239,13 +250,13 @@ namespace bbot } catch (const manifest_serialization& e) { - diag_record dr; if (hard) dr << fail; else dr << error; + diag_record dr; if (fh) dr << fail; else dr << error; dr << "invalid " << what << " manifest: " << e.description; } catch (const io_error& e) { - diag_record dr; if (hard) dr << fail; else dr << error; + diag_record dr; if (fh) dr << fail; else dr << error; fail << "unable to write " << what << " manifest " << name << ": " << e; } |