File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -64,19 +64,30 @@ impl ExternArgs {
6464 let try_path: PathBuf = [ & proj_root. to_string_lossy ( ) , "src" , fname]
6565 . iter ( )
6666 . collect ( ) ;
67- touch ( & try_path) ?;
68- break ;
69- // file should be closed when f goes out of scope at bottom of this loop
67+ if try_path. exists ( ) {
68+ touch ( & try_path) ?;
69+ self . run_cargo ( proj_root) ?;
70+ return Ok ( self ) ;
71+ // file should be closed when f goes out of scope at bottom of this loop
72+ }
7073 }
74+ bail ! ( "Couldn't find source target in project {:?}" , proj_root)
75+ }
7176
77+ fn run_cargo ( & mut self , proj_root : & Path ) -> Result < & Self > {
7278 let mut cmd = Command :: new ( "cargo" ) ;
7379 cmd. current_dir ( & proj_root) . arg ( "build" ) . arg ( "--verbose" ) ;
7480
7581 info ! ( "running {:?}" , cmd) ;
7682 let output = cmd. output ( ) ?;
7783
7884 if !output. status . success ( ) {
79- bail ! ( "Exit status {} from {:?}" , output. status, cmd) ;
85+ bail ! (
86+ "Exit status {} from {:?}\n Message:\n {:?}" ,
87+ output. status,
88+ cmd,
89+ std:: string:: String :: from_utf8_lossy( & output. stderr)
90+ ) ;
8091 }
8192
8293 let cmd_resp: & str = std:: str:: from_utf8 ( & output. stderr ) ?;
You can’t perform that action at this time.
0 commit comments