From a7efabf301f23364ac2335c80c5e1e712bc43204 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 10 Nov 2016 00:26:54 +0300 Subject: Add cat, false and true builtins --- build2/test/script/runner.cxx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'build2/test/script/runner.cxx') diff --git a/build2/test/script/runner.cxx b/build2/test/script/runner.cxx index 1d6920a..aa35612 100644 --- a/build2/test/script/runner.cxx +++ b/build2/test/script/runner.cxx @@ -406,7 +406,8 @@ namespace build2 ifd.reset (fdnull ()); // @@ Eventually will be throwing. if (ifd.get () == -1) // @@ TMP - throw io_error ("", error_code (errno, system_category ())); + throw io_error ( + error_code (errno, system_category ()).message ()); in = -2; } @@ -512,7 +513,8 @@ namespace build2 fd.reset (fdnull ()); // @@ Eventully will be throwing. if (fd.get () == -1) // @@ TMP - throw io_error ("", error_code (errno, system_category ())); + throw io_error ( + error_code (errno, system_category ()).message ()); } catch (const io_error& e) { @@ -590,13 +592,24 @@ namespace build2 } optional status; - builtin b (builtins.find (c.program.string ())); + builtin* b (builtins.find (c.program.string ())); if (b != nullptr) { // Execute the builtin. // - status = (*b) (sp, c.arguments, move (ifd), move (ofd), move (efd)); + try + { + future f ( + (*b) (sp, c.arguments, move (ifd), move (ofd), move (efd))); + + status = f.get (); + } + catch (const system_error& e) + { + fail (ll) << "unable to execute " << c.program << " builtin: " + << e.what (); + } } else { -- cgit v1.1