std: Refactor process spawning on Unix
* 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.
This commit is contained in:
parent
096dbf84c7
commit
6c41984690
4 changed files with 165 additions and 167 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue