diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-04 13:38:27 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-04 13:38:27 +0200 |
commit | f3f46a1656207a1c681e7c53cc3bd2c9a28fa887 (patch) | |
tree | e3f35ce96d8af5c7d0ec500abe502c3b681092e6 /butl/process.cxx | |
parent | decd319bc1bc7d427f92feba29d408eb2edb973d (diff) |
Allow calling process::wait() multiple types, make process move-only
Diffstat (limited to 'butl/process.cxx')
-rw-r--r-- | butl/process.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
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; } |