From f3f46a1656207a1c681e7c53cc3bd2c9a28fa887 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 4 Sep 2015 13:38:27 +0200 Subject: Allow calling process::wait() multiple types, make process move-only --- butl/process.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'butl/process.cxx') diff --git a/butl/process.cxx b/butl/process.cxx index 9025bdb..194ea4e 100644 --- a/butl/process.cxx +++ b/butl/process.cxx @@ -108,12 +108,14 @@ namespace butl bool process:: wait () { - int status; - int r (waitpid (id, &status, 0)); - id = 0; // We have tried. + if (id != 0) + { + int r (waitpid (id, &status, 0)); + id = 0; // We have tried. - if (r == -1) - throw process_error (errno, false); + if (r == -1) + throw process_error (errno, false); + } return WIFEXITED (status) && WEXITSTATUS (status) == 0; } -- cgit v1.1