mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
roc dev: report the status code of the child process
This commit is contained in:
parent
1646dc4e73
commit
3d3243bfb5
1 changed files with 11 additions and 5 deletions
|
@ -1086,14 +1086,20 @@ fn roc_dev_native(
|
|||
|
||||
std::process::exit(1)
|
||||
}
|
||||
1.. => {
|
||||
pid @ 1.. => {
|
||||
let sigchld = Arc::new(AtomicBool::new(false));
|
||||
signal_hook::flag::register(signal_hook::consts::SIGCHLD, Arc::clone(&sigchld))
|
||||
.unwrap();
|
||||
|
||||
loop {
|
||||
let exit_code = loop {
|
||||
match memory.wait_for_child(sigchld.clone()) {
|
||||
ChildProcessMsg::Terminate => break,
|
||||
ChildProcessMsg::Terminate => {
|
||||
let mut status = 0;
|
||||
let options = 0;
|
||||
unsafe { libc::waitpid(pid, &mut status, options) };
|
||||
|
||||
break status;
|
||||
}
|
||||
ChildProcessMsg::Expect => {
|
||||
roc_repl_expect::run::render_expects_in_memory(
|
||||
&mut writer,
|
||||
|
@ -1121,9 +1127,9 @@ fn roc_dev_native(
|
|||
memory.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
std::process::exit(0)
|
||||
std::process::exit(exit_code)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue