std: Clean out old unstable + deprecated APIs
These should all have been deprecated for at least one cycle, so this commit cleans them all out.
This commit is contained in:
parent
a967611d8f
commit
b64c9d5670
29 changed files with 52 additions and 1212 deletions
|
|
@ -34,21 +34,6 @@ pub trait CommandExt {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
fn gid(&mut self, id: u32) -> &mut process::Command;
|
||||
|
||||
/// Create a new session (cf. `setsid(2)`) for the child process. This means
|
||||
/// that the child is the leader of a new process group. The parent process
|
||||
/// remains the child reaper of the new process.
|
||||
///
|
||||
/// This is not enough to create a daemon process. The *init* process should
|
||||
/// be the child reaper of a daemon. This can be achieved if the parent
|
||||
/// process exit. Moreover, a daemon should not have a controlling terminal.
|
||||
/// To achieve this, a session leader (the child) must spawn another process
|
||||
/// (the daemon) in the same session.
|
||||
#[unstable(feature = "process_session_leader", reason = "recently added",
|
||||
issue = "27811")]
|
||||
#[rustc_deprecated(reason = "use `before_exec` instead",
|
||||
since = "1.9.0")]
|
||||
fn session_leader(&mut self, on: bool) -> &mut process::Command;
|
||||
|
||||
/// Schedules a closure to be run just before the `exec` function is
|
||||
/// invoked.
|
||||
///
|
||||
|
|
@ -112,11 +97,6 @@ impl CommandExt for process::Command {
|
|||
self
|
||||
}
|
||||
|
||||
fn session_leader(&mut self, on: bool) -> &mut process::Command {
|
||||
self.as_inner_mut().session_leader(on);
|
||||
self
|
||||
}
|
||||
|
||||
fn before_exec<F>(&mut self, f: F) -> &mut process::Command
|
||||
where F: FnMut() -> io::Result<()> + Send + Sync + 'static
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ pub struct Command {
|
|||
cwd: Option<CString>,
|
||||
uid: Option<uid_t>,
|
||||
gid: Option<gid_t>,
|
||||
session_leader: bool,
|
||||
saw_nul: bool,
|
||||
closures: Vec<Box<FnMut() -> io::Result<()> + Send + Sync>>,
|
||||
stdin: Option<Stdio>,
|
||||
|
|
@ -105,7 +104,6 @@ impl Command {
|
|||
cwd: None,
|
||||
uid: None,
|
||||
gid: None,
|
||||
session_leader: false,
|
||||
saw_nul: saw_nul,
|
||||
closures: Vec::new(),
|
||||
stdin: None,
|
||||
|
|
@ -197,9 +195,6 @@ impl Command {
|
|||
pub fn gid(&mut self, id: gid_t) {
|
||||
self.gid = Some(id);
|
||||
}
|
||||
pub fn session_leader(&mut self, session_leader: bool) {
|
||||
self.session_leader = session_leader;
|
||||
}
|
||||
|
||||
pub fn before_exec(&mut self,
|
||||
f: Box<FnMut() -> io::Result<()> + Send + Sync>) {
|
||||
|
|
@ -367,12 +362,6 @@ impl Command {
|
|||
|
||||
t!(cvt(libc::setuid(u as uid_t)));
|
||||
}
|
||||
if self.session_leader {
|
||||
// Don't check the error of setsid because it fails if we're the
|
||||
// process leader already. We just forked so it shouldn't return
|
||||
// error, but ignore it anyway.
|
||||
let _ = libc::setsid();
|
||||
}
|
||||
if let Some(ref cwd) = self.cwd {
|
||||
t!(cvt(libc::chdir(cwd.as_ptr())));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue