File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -122,18 +122,28 @@ pub fn main() {
122
122
if let Some ( "clippy" ) = std:: env:: args ( ) . nth ( 1 ) . as_ref ( ) . map ( AsRef :: as_ref) {
123
123
let args = wrap_args ( std:: env:: args ( ) . skip ( 2 ) , dep_path, sys_root) ;
124
124
let path = std:: env:: current_exe ( ) . expect ( "current executable path invalid" ) ;
125
- std:: process:: Command :: new ( "cargo" )
125
+ let exit_status = std:: process:: Command :: new ( "cargo" )
126
126
. args ( & args)
127
127
. env ( "RUSTC" , path)
128
128
. spawn ( ) . expect ( "could not run cargo" )
129
129
. wait ( ) . expect ( "failed to wait for cargo?" ) ;
130
+
131
+ if let Some ( code) = exit_status. code ( ) {
132
+ std:: process:: exit ( code) ;
133
+ }
130
134
} else {
131
135
let args: Vec < String > = if env:: args ( ) . any ( |s| s == "--sysroot" ) {
132
136
env:: args ( ) . collect ( )
133
137
} else {
134
138
env:: args ( ) . chain ( Some ( "--sysroot" . to_owned ( ) ) ) . chain ( Some ( sys_root) ) . collect ( )
135
139
} ;
136
- rustc_driver:: run_compiler ( & args, & mut ClippyCompilerCalls :: new ( ) ) ;
140
+ let ( result, _) = rustc_driver:: run_compiler ( & args, & mut ClippyCompilerCalls :: new ( ) ) ;
141
+
142
+ if let Err ( err_count) = result {
143
+ if err_count > 0 {
144
+ std:: process:: exit ( 1 ) ;
145
+ }
146
+ }
137
147
}
138
148
}
139
149
You can’t perform that action at this time.
0 commit comments