Permalink
Browse files

Handle Signals w/ Forks

Closes #577
  • Loading branch information...
mmstick committed Nov 6, 2017
1 parent e9dd8f1 commit 079a2367641ad0bc60b673e2e55cb29914fce09b
Showing with 5 additions and 1 deletion.
  1. +4 −0 src/shell/mod.rs
  2. +1 −1 src/shell/pipe_exec/job_control.rs
View
@@ -411,6 +411,8 @@ impl<'a> Shell {
use std::process::exit;
use sys;
sys::signals::block();
let (stdout_read, stdout_write) = sys::pipe2(sys::O_CLOEXEC)
.map(|fds| unsafe { (File::from_raw_fd(fds.0), File::from_raw_fd(fds.1)) })
.map_err(IonError::Fork)?;
@@ -421,6 +423,8 @@ impl<'a> Shell {
match unsafe { sys::fork() } {
Ok(0) => {
sys::signals::unblock();
let _ = sys::dup2(stdout_write.as_raw_fd(), sys::STDOUT_FILENO);
let _ = sys::dup2(stderr_write.as_raw_fd(), sys::STDERR_FILENO);
@@ -3,10 +3,10 @@ use super::super::Shell;
use super::super::signals;
use super::super::status::*;
use std::fmt;
use std::process;
use std::sync::{Arc, Mutex};
use std::thread::{sleep, spawn};
use std::time::Duration;
use std::process;
use sys;
use sys::job_control as self_sys;

0 comments on commit 079a236

Please sign in to comment.