Skip to content

Commit

Permalink
std: Refactor process spawning on Unix
Browse files Browse the repository at this point in the history
* Build up the argp/envp pointers while the `Command` is being constructed
  rather than only when `spawn` is called. This will allow better sharing of
  code between fork/exec paths.
* Rename `child_after_fork` to `exec` and have it only perform the exec half of
  the spawning. This also means the return type has changed to `io::Error`
  rather than `!` to represent errors that happen.
  • Loading branch information
alexcrichton committed Feb 10, 2016
1 parent 096dbf8 commit 6c41984
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 168 deletions.
4 changes: 3 additions & 1 deletion src/libstd/process.rs
Expand Up @@ -209,7 +209,9 @@ impl Command {
/// Add multiple arguments to pass to the program.
#[stable(feature = "process", since = "1.0.0")]
pub fn args<S: AsRef<OsStr>>(&mut self, args: &[S]) -> &mut Command {
self.inner.args(args.iter().map(AsRef::as_ref));
for arg in args {
self.arg(arg.as_ref());
}
self
}

Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sys/unix/ext/process.rs
Expand Up @@ -12,8 +12,8 @@

#![stable(feature = "rust1", since = "1.0.0")]

use os::unix::raw::{uid_t, gid_t};
use os::unix::io::{FromRawFd, RawFd, AsRawFd, IntoRawFd};
use os::unix::raw::{uid_t, gid_t};
use process;
use sys;
use sys_common::{AsInnerMut, AsInner, FromInner, IntoInner};
Expand Down

0 comments on commit 6c41984

Please sign in to comment.