diff options
-rw-r--r-- | crawl-ref/source/util/fake_pty.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crawl-ref/source/util/fake_pty.c b/crawl-ref/source/util/fake_pty.c index 20d2c37858..5db9d78cd7 100644 --- a/crawl-ref/source/util/fake_pty.c +++ b/crawl-ref/source/util/fake_pty.c @@ -78,7 +78,13 @@ int main(int argc, char * const *argv) close(slave); slurp_output(); if (waitpid(crawl, &ret, 0) != crawl) - ret = 1; // can't happen - return ret; + return 1; // can't happen + if (WIFEXITED(ret)) + return WEXITSTATUS(ret); + if (WIFSIGNALED(ret)) + return 128 + WTERMSIG(ret); + // Neither exited nor signaled? Did the process eat mushrooms meant + // fo the mother-in-law or what? + return 1; } } |