diff --git a/src/lib.rs b/src/lib.rs index 876457ac118b9eecd5244e2517ac577a932d42ab..b5d6c85a7ee499f14730c7c48814900921e5e445 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,6 +3,7 @@ #![feature(conservative_impl_trait)] #![feature(integer_atomics)] #![feature(pointer_methods)] +#![feature(getpid)] extern crate app_dirs; #[macro_use] diff --git a/src/main.rs b/src/main.rs index 48327da4649e88362412ce5b8c753ab6a9403d7a..f2767123dd98df95ff25b51a830466b8b6fc3a9c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,7 @@ #![feature(conservative_impl_trait)] #![feature(integer_atomics)] #![feature(pointer_methods)] +#![feature(getpid)] // For a performance boost on Linux // #![feature(alloc_system)] diff --git a/src/shell/binary/prompt.rs b/src/shell/binary/prompt.rs index 54293de9f6b710102328b4816ca5e528d56e101e..0e86f154b5e243457d9286be0cccd8c88e45fcfa 100644 --- a/src/shell/binary/prompt.rs +++ b/src/shell/binary/prompt.rs @@ -1,6 +1,7 @@ use super::super::{Function, Shell}; use parser::shell_expand::expand_string; use std::io::Read; +use std::process; use sys; pub(crate) fn prompt(shell: &mut Shell) -> String { @@ -41,6 +42,6 @@ pub(crate) fn prompt_fn(shell: &mut Shell) -> Option<String> { } // Ensure that the parent retains ownership of the terminal before exiting. - let _ = sys::tcsetpgrp(sys::STDIN_FILENO, sys::getpid().unwrap()); + let _ = sys::tcsetpgrp(sys::STDIN_FILENO, process::id()); output } diff --git a/src/shell/mod.rs b/src/shell/mod.rs index adda1d98ae4fa36f4e23a6ce05b4ecdc1b82fb87..19b9b0311434122b501dcdfcebaa199bb753092e 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -534,7 +534,7 @@ impl<'a> Expander for Shell { } // Ensure that the parent retains ownership of the terminal before exiting. - let _ = sys::tcsetpgrp(sys::STDIN_FILENO, sys::getpid().unwrap()); + let _ = sys::tcsetpgrp(sys::STDIN_FILENO, process::id()); output } } diff --git a/src/shell/pipe_exec/job_control.rs b/src/shell/pipe_exec/job_control.rs index 786f7ab53c1df6e7fbe3bea011b6647c5ded8870..6cd9952f38cbf3389f589361a6f86c0fe3166e87 100644 --- a/src/shell/pipe_exec/job_control.rs +++ b/src/shell/pipe_exec/job_control.rs @@ -6,6 +6,7 @@ use std::fmt; 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; @@ -123,7 +124,7 @@ impl JobControl for Shell { } }; // Have the shell reclaim the TTY - set_foreground_as(sys::getpid().unwrap()); + set_foreground_as(process::id()); status } diff --git a/src/shell/pipe_exec/mod.rs b/src/shell/pipe_exec/mod.rs index 219467643dd176b400d32ce26a7f4890588d1d60..b4e40455b7df8519a38e9981c6f7d9a51aa0e9f5 100644 --- a/src/shell/pipe_exec/mod.rs +++ b/src/shell/pipe_exec/mod.rs @@ -25,7 +25,7 @@ use std::iter; use std::os::unix::io::{AsRawFd, FromRawFd, RawFd}; use std::os::unix::process::CommandExt; use std::path::Path; -use std::process::{exit, Command}; +use std::process::{self, exit, Command}; use sys; type RefinedItem = (RefinedJob, JobKind, Vec<Redirection>, Vec<Input>); @@ -427,7 +427,7 @@ impl PipelineExecution for Shell { let exit_status = pipe(self, piped_commands, foreground); // Set the shell as the foreground process again to regain the TTY. if foreground && !self.is_library { - let _ = sys::tcsetpgrp(0, sys::getpid().unwrap()); + let _ = sys::tcsetpgrp(0, process::id()); } exit_status }