mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Get exit code correctly
`status` isn't the exit code of the program - the actual exit code is shifted left by 8 bits. We can get that with a `WIFEXITED` check to make sure the exit code exists, followed by `WEXITSTATUS` to retrieve it.
This commit is contained in:
parent
1f0303cf53
commit
11c9b90551
1 changed files with 7 additions and 1 deletions
|
@ -1244,7 +1244,13 @@ fn roc_dev_native(
|
|||
let options = 0;
|
||||
unsafe { libc::waitpid(pid, &mut status, options) };
|
||||
|
||||
break status;
|
||||
// if `WIFEXITED` returns false, `WEXITSTATUS` will just return junk
|
||||
break if libc::WIFEXITED(status) {
|
||||
libc::WEXITSTATUS(status)
|
||||
} else {
|
||||
// we don't have an exit code, so we probably shouldn't make one up
|
||||
0
|
||||
};
|
||||
}
|
||||
ChildProcessMsg::Expect => {
|
||||
roc_repl_expect::run::render_expects_in_memory(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue