aboutsummaryrefslogtreecommitdiff
path: root/mod/external-handler.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'mod/external-handler.cxx')
-rw-r--r--mod/external-handler.cxx29
1 files changed, 16 insertions, 13 deletions
diff --git a/mod/external-handler.cxx b/mod/external-handler.cxx
index 4237439..3a85bd8 100644
--- a/mod/external-handler.cxx
+++ b/mod/external-handler.cxx
@@ -1,5 +1,4 @@
// file : mod/external-handler.cxx -*- C++ -*-
-// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
#include <mod/external-handler.hxx>
@@ -14,9 +13,10 @@
#include <type_traits> // static_assert
#include <system_error> // error_code, generic_category()
-#include <libbutl/process.mxx>
-#include <libbutl/fdstream.mxx>
-#include <libbutl/process-io.mxx> // operator<<(ostream, process_args)
+#include <libbutl/process.hxx>
+#include <libbutl/fdstream.hxx>
+#include <libbutl/process-io.hxx> // operator<<(ostream, process_args)
+#include <libbutl/manifest-parser.hxx>
using namespace std;
using namespace butl;
@@ -96,15 +96,18 @@ namespace brep
data_dir));
pipe.out.close ();
+ // Kill the process and wait for its completion.
+ //
auto kill = [&pr, &warn, &handler, &ref] ()
- {
- // We may still end up well (see below), thus this is a warning.
- //
- warn << "ref " << ref << ": process " << handler
- << " execution timeout expired";
+ {
+ // We may still end up well (see below), thus this is a warning.
+ //
+ warn << "ref " << ref << ": process " << handler
+ << " execution timeout expired";
- pr.kill ();
- };
+ pr.kill ();
+ pr.wait ();
+ };
try
{
@@ -127,7 +130,7 @@ namespace brep
}
timeval tm {wd.count () / 1000 /* seconds */,
- wd.count () % 1000 * 1000 /* microseconds */};
+ wd.count () % 1000 * 1000 /* microseconds */};
fd_set rd;
FD_ZERO (&rd);
@@ -314,7 +317,7 @@ namespace brep
assert (e != nullptr);
if (!(*e == '\0' && c >= 100 && c < 600))
- bad_value ("invalid HTTP status '" + v + "'");
+ bad_value ("invalid HTTP status '" + v + '\'');
// Save the HTTP status.
//