File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- //! Launch commands very similarly to `std::process:: Command`, but with `git` specific capabilities and adjustments.
1+ //! Launch commands very similarly to `Command`, but with `git` specific capabilities and adjustments.
22#![ deny( rust_2018_idioms, missing_docs) ]
33#![ forbid( unsafe_code) ]
44
@@ -15,7 +15,7 @@ pub struct Prepare {
1515
1616mod prepare {
1717 use crate :: Prepare ;
18- use std:: process:: Stdio ;
18+ use std:: process:: { Command , Stdio } ;
1919
2020 /// Builder
2121 impl Prepare {
@@ -49,16 +49,23 @@ mod prepare {
4949 impl Prepare {
5050 /// Spawn the command as configured.
5151 pub fn spawn ( self ) -> std:: io:: Result < std:: process:: Child > {
52+ let mut cmd: Command = self . into ( ) ;
53+ cmd. spawn ( )
54+ }
55+ }
56+
57+ impl Into < Command > for Prepare {
58+ fn into ( self ) -> Command {
5259 let mut cmd = if self . use_shell {
53- let mut cmd = std :: process :: Command :: new ( if cfg ! ( windows) { "sh" } else { "/bin/sh" } ) ;
60+ let mut cmd = Command :: new ( if cfg ! ( windows) { "sh" } else { "/bin/sh" } ) ;
5461 cmd. arg ( "-c" ) ;
5562 cmd. arg ( self . command ) ;
5663 cmd
5764 } else {
58- std :: process :: Command :: new ( self . command )
65+ Command :: new ( self . command )
5966 } ;
6067 cmd. stdin ( self . stdin ) . stdout ( self . stdout ) . stderr ( self . stderr ) ;
61- cmd. spawn ( )
68+ cmd
6269 }
6370 }
6471}
You can’t perform that action at this time.
0 commit comments