@@ -15,8 +15,12 @@ static PROGRESS_STYLE: Lazy<ProgressStyle> = Lazy::new(|| {
1515
1616#[ derive( Error , Debug ) ]
1717pub enum Error {
18- #[ error( "Can't execute the command because {0}" ) ]
19- FailedExecute ( #[ from] std:: io:: Error ) ,
18+ #[ error( "Can't execute `{command}` because {source}" ) ]
19+ FailedExecute {
20+ command : String ,
21+ #[ source]
22+ source : std:: io:: Error ,
23+ } ,
2024
2125 #[ error(
2226 "build error\n === Please follow the messages below to resolve dependencies, etc. ===\n \n {0}"
@@ -35,7 +39,7 @@ pub trait Command {
3539 & self ,
3640 current_dir : impl AsRef < Path > ,
3741 handle_wait : impl Fn ( ) ,
38- ) -> Result < std:: process:: Output , std :: io :: Error > {
42+ ) -> Result < std:: process:: Output , Error > {
3943 let command = self . command ( ) ;
4044 let args = self . args ( ) ;
4145 let current_dir = current_dir. as_ref ( ) . to_path_buf ( ) ;
@@ -51,7 +55,10 @@ pub trait Command {
5155 } ) ;
5256 loop {
5357 if let Ok ( output) = rx. try_recv ( ) {
54- break output;
58+ break output. map_err ( |source| Error :: FailedExecute {
59+ command : self . command_line ( ) ,
60+ source,
61+ } ) ;
5562 }
5663 handle_wait ( ) ;
5764 thread:: sleep ( Duration :: from_millis ( 50 ) ) ;
@@ -82,10 +89,10 @@ impl Command for Configure<'_> {
8289 "./configure"
8390 }
8491 fn args ( & self ) -> Vec < String > {
85- self . opts
92+ [ format ! ( "--prefix={}" , self . prefix . display ( ) ) . as_str ( ) ]
8693 . iter ( )
94+ . chain ( self . opts . iter ( ) )
8795 . map ( |& s| s. to_owned ( ) )
88- . chain ( [ format ! ( "--prefix={}" , self . prefix. display( ) ) ] )
8996 . collect_vec ( )
9097 }
9198 fn order ( & self ) -> usize {
0 commit comments