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 {
64
64
let try_path: PathBuf = [ & proj_root. to_string_lossy ( ) , "src" , fname]
65
65
. iter ( )
66
66
. 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
+ }
70
73
}
74
+ bail ! ( "Couldn't find source target in project {:?}" , proj_root)
75
+ }
71
76
77
+ fn run_cargo ( & mut self , proj_root : & Path ) -> Result < & Self > {
72
78
let mut cmd = Command :: new ( "cargo" ) ;
73
79
cmd. current_dir ( & proj_root) . arg ( "build" ) . arg ( "--verbose" ) ;
74
80
75
81
info ! ( "running {:?}" , cmd) ;
76
82
let output = cmd. output ( ) ?;
77
83
78
84
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
+ ) ;
80
91
}
81
92
82
93
let cmd_resp: & str = std:: str:: from_utf8 ( & output. stderr ) ?;
You can’t perform that action at this time.
0 commit comments