aboutsummaryrefslogtreecommitdiff
path: root/build2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-03-22 19:20:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-03-22 19:20:55 +0200
commita291d146c1c730510ca3e6b4ecae6c4694dad2cd (patch)
tree93b0a819c5f8c83b72c492987b6eeecc887e05ce /build2
parentadddeca028100355a922cc4e45226ce7f18420c9 (diff)
Diagnose unhandled exceptions in testscript builtins thread thunk
Diffstat (limited to 'build2')
-rw-r--r--build2/test/script/builtin.cxx21
1 files changed, 15 insertions, 6 deletions
diff --git a/build2/test/script/builtin.cxx b/build2/test/script/builtin.cxx
index 6f63551..3305c3a 100644
--- a/build2/test/script/builtin.cxx
+++ b/build2/test/script/builtin.cxx
@@ -1362,13 +1362,22 @@ namespace build2
scope& sp,
const strings& args,
auto_fd in, auto_fd out, auto_fd err,
- promise<uint8_t> p)
+ promise<uint8_t> p) noexcept
{
- // The use of set_value_at_thread_exit() would be more appropriate but
- // the function is not supported by old versions of g++ (e.g., not in
- // 4.9). There could also be overhead associated with it.
- //
- p.set_value (fn (sp, args, move (in), move (out), move (err)));
+ try
+ {
+ // The use of set_value_at_thread_exit() would be more appropriate
+ // but the function is not supported by old versions of g++ (e.g.,
+ // not in 4.9). There could also be overhead associated with it.
+ //
+ p.set_value (fn (sp, args, move (in), move (out), move (err)));
+ }
+ catch (const std::exception& e)
+ {
+ *diag_stream << "unhandled exception: " << e;
+ assert (false);
+ abort ();
+ }
}
// Run builtin implementation asynchronously.