aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-12-17 09:13:12 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-12-17 09:13:12 +0200
commit4922e33ba25a7bb3f00e28ad7f5ae8754c403112 (patch)
tree6144e1aad2ae6d09d5b73c6ac1c772a04e9cef74
parentb5bcfa655986310f70755551b12fb259ad91d774 (diff)
Convert to using operator<<(ostream,process_exit)
-rw-r--r--bbot/agent/machine.cxx4
-rw-r--r--bbot/utility.txx5
-rw-r--r--bbot/worker/worker.cxx14
3 files changed, 7 insertions, 16 deletions
diff --git a/bbot/agent/machine.cxx b/bbot/agent/machine.cxx
index 955ab77..882f210 100644
--- a/bbot/agent/machine.cxx
+++ b/bbot/agent/machine.cxx
@@ -59,7 +59,7 @@ namespace bbot
"--to-destination", addr + ':' + to_string (port));
if (e != 0 && !ignore_errors)
- fail << "process iptables terminated with non-zero exit code";
+ fail << "process iptables exited with non-zero code";
// Nobody really knows whether this is really needed (really)...
//
@@ -78,7 +78,7 @@ namespace bbot
"-j", "ACCEPT");
if (e != 0 && !ignore_errors)
- fail << "process iptables terminated with non-zero exit code";
+ fail << "process iptables exited with non-zero code";
}
static string
diff --git a/bbot/utility.txx b/bbot/utility.txx
index edfc3a7..5ac8995 100644
--- a/bbot/utility.txx
+++ b/bbot/utility.txx
@@ -52,8 +52,7 @@ namespace bbot
const process_exit& e (*pr.exit);
if (!e.normal ())
- fail (fh) << "process " << p << " terminated abnormally: "
- << e.description () << (e.core () ? " (core dumped)" : "");
+ fail (fh) << "process " << p << " " << e;
return e.code ();
}
@@ -68,7 +67,7 @@ namespace bbot
run_io_finish (tracer& t, process& pr, const P& p, bool fh)
{
if (run_io_finish_exit (t, pr, p, fh) != 0)
- fail (fh) << "process " << p << " terminated with non-zero exit code";
+ fail (fh) << "process " << p << " exited with non-zero code";
}
template <typename I, typename O, typename E, typename P, typename... A>
diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx
index 3579f36..a8e0f6d 100644
--- a/bbot/worker/worker.cxx
+++ b/bbot/worker/worker.cxx
@@ -162,17 +162,9 @@ run_cmd (tracer& t,
const process_exit& e (*pr.exit);
- if (e.normal ())
- {
- add (name + " exited with code " + to_string (e.code ()));
- return result_status::error;
- }
- else
- {
- add (name + " terminated abnormally: " + e.description () +
- (e.core () ? " (core dumped)" : ""));
- return result_status::abnormal;
- }
+ add (name + " " + to_string (e));
+
+ return e.normal () ? result_status::error : result_status::abnormal;
}
catch (const process_error& e)
{