Impl From<std::process::Command> for Command
Allow creating Command from std::process::Command, similar to what tokio::process::Command supports.
This commit is contained in:
parent
69789af2ca
commit
870cd2dc1f
22
src/lib.rs
22
src/lib.rs
|
@ -639,14 +639,7 @@ impl Command {
|
|||
/// let mut cmd = Command::new("ls");
|
||||
/// ```
|
||||
pub fn new<S: AsRef<OsStr>>(program: S) -> Command {
|
||||
Command {
|
||||
inner: std::process::Command::new(program),
|
||||
stdin: false,
|
||||
stdout: false,
|
||||
stderr: false,
|
||||
reap_on_drop: true,
|
||||
kill_on_drop: false,
|
||||
}
|
||||
Self::from(std::process::Command::new(program))
|
||||
}
|
||||
|
||||
/// Adds a single argument to pass to the program.
|
||||
|
@ -946,6 +939,19 @@ impl Command {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<std::process::Command> for Command {
|
||||
fn from(inner: std::process::Command) -> Self {
|
||||
Self {
|
||||
inner,
|
||||
stdin: false,
|
||||
stdout: false,
|
||||
stderr: false,
|
||||
reap_on_drop: true,
|
||||
kill_on_drop: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for Command {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
if f.alternate() {
|
||||
|
|
Loading…
Reference in New Issue