Skip to content
Snippets Groups Projects
Commit 079a2367 authored by Michael Aaron Murphy's avatar Michael Aaron Murphy
Browse files

Handle Signals w/ Forks

Closes #577
parent e9dd8f1a
No related branches found
No related tags found
No related merge requests found
......@@ -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% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment