diff options
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; } |