From 9cfcea48e46deb9755c049c2f435843ac702b91c Mon Sep 17 00:00:00 2001 From: Adam Borowski Date: Sat, 2 Nov 2013 02:30:34 +0100 Subject: Fix fake_pty not passing return codes correctly. --- crawl-ref/source/util/fake_pty.c | 10 ++++++++-- 1 file 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; } } -- cgit v1.2.3-54-g00ecf