Merge v3 with T15 into v3-t22
This commit is contained in:
@@ -44,13 +44,7 @@ impl Command {
|
||||
pub fn stderr(&mut self, mode: Stdio) -> &mut Self { self.stderr = mode; self }
|
||||
/// Resolve PATH and start the component.
|
||||
pub fn spawn(&self) -> io::Result<Child> {
|
||||
let program = if self.program.contains('/') { self.program.clone() } else {
|
||||
self.env.get("PATH").map(String::as_str).unwrap_or("/usr/local/bin:/bin").split(':')
|
||||
.map(|dir| self.cwd.join(dir).join(&self.program))
|
||||
.find(|p| p.is_file()).ok_or_else(|| io::Error::new(io::ErrorKind::NotFound, &self.program[..]))?
|
||||
.to_string_lossy().into_owned()
|
||||
};
|
||||
let child = host::spawn(&host::Request { program, argv: std::iter::once(self.program.clone()).chain(self.args.clone()).collect(),
|
||||
let child = host::spawn(&host::Request { program: self.program.clone(), argv: std::iter::once(self.program.clone()).chain(self.args.clone()).collect(),
|
||||
env: self.env.clone().into_iter().collect(), cwd: self.cwd.to_string_lossy().into_owned(), group: self.group,
|
||||
stdin: self.stdin, stdout: self.stdout, stderr: self.stderr }).map_err(io::Error::other)?;
|
||||
Ok(Child { stdin: matches!(self.stdin, Stdio::Pipe).then(|| child.stdin()),
|
||||
|
||||
Reference in New Issue
Block a user