File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 6868//! Which is, a lot nicer!
6969
7070pub use error:: * ;
71+ #[ cfg( unix) ]
72+ use std:: os:: unix:: process:: CommandExt ;
7173use std:: {
7274 ffi:: OsStr ,
7375 path:: Path ,
@@ -168,6 +170,7 @@ impl Cmd {
168170 self . status ( ) ?;
169171 Ok ( ( ) )
170172 }
173+
171174 /// Equivalent to [`std::process::Command::spawn`][],
172175 /// but logged and with the error wrapped.
173176 pub fn spawn ( & mut self ) -> Result < std:: process:: Child > {
@@ -213,6 +216,19 @@ impl Cmd {
213216 self . status_inner ( )
214217 }
215218
219+ #[ cfg( unix) ]
220+ /// Equivalent to [`std::process::Command::exec`][]
221+ /// but logged, with the error wrapped
222+ /// Note that, like the original, this will never return on success
223+ pub fn exec ( & mut self ) -> Result < ExitStatus > {
224+ self . log_command ( ) ;
225+ let cause = self . inner . exec ( ) ;
226+ Err ( AxoprocessError :: Exec {
227+ summary : self . summary . clone ( ) ,
228+ cause,
229+ } )
230+ }
231+
216232 /// Actual impl of status, split out to support a polyfill
217233 fn status_inner ( & mut self ) -> Result < ExitStatus > {
218234 self . log_command ( ) ;
You can’t perform that action at this time.
0 commit comments