message: Sync Redox and Unix sys modules
diff: @@ -85,6 +85,7 @@ pub(crate) fn watch_background(
  pub(crate) fn watch_foreground(shell: &mut Shell, pid: i32, command: &str) -> i32 {
  let mut signaled = 0;
  + let mut exit_status = 0;
  let mut status;
  loop {
  @@ -92,6 +93,7 @@ pub(crate) fn watch_foreground(shell: &mut Shell, pid: i32, command: &str) -> i3
  status = 0;
  match waitpid(pid as usize, &mut status, WUNTRACED) {
  Err(err) => match err.errno {
  + ECHILD if signaled == 0 => break exit_status,
  ECHILD => break signaled,
  errno => {
  eprintln!("ion: waitpid error: {}", errno);
  @@ -99,7 +101,7 @@ pub(crate) fn watch_foreground(shell: &mut Shell, pid: i32, command: &str) -> i3
  }
  },
  Ok(0) => (),
  - Ok(_pid) if wifexited(status) => break wexitstatus(status) as i32,
  + Ok(_pid) if wifexited(status) => exit_status = WEXITSTATUS(status),
  Ok(pid) if wifsignaled(status) => {
  let signal = wtermsig(status);
  if signal == SIGPIPE {
  @@ -122,7 +124,11 @@ pub(crate) fn watch_foreground(shell: &mut Shell, pid: i32, command: &str) -> i3
  signaled = 128 + signal as i32;
  }
  Ok(pid) if wifstopped(status) => {
  - shell.send_to_background(pid as u32, ProcessState::Stopped, command.into());
  + shell.send_to_background(
  + pid.abs() as u32,
  + ProcessState::Stopped,
  + command.into()
  + );
  shell.break_flow = true;
  break 128 + wstopsig(status) as i32;
  }
  