@@ -33,6 +33,7 @@ use std::os::consts::{macos, freebsd, linux, android, win32};
33
33
use std:: ptr;
34
34
use std:: run;
35
35
use std:: str;
36
+ use std:: io;
36
37
use std:: io:: fs;
37
38
use extra:: tempfile:: TempDir ;
38
39
use syntax:: abi;
@@ -97,6 +98,7 @@ pub mod write {
97
98
use util:: common:: time;
98
99
99
100
use std:: c_str:: ToCStr ;
101
+ use std:: io;
100
102
use std:: libc:: { c_uint, c_int} ;
101
103
use std:: path:: Path ;
102
104
use std:: run;
@@ -310,7 +312,11 @@ pub mod write {
310
312
assembly. as_str ( ) . unwrap ( ) . to_owned ( ) ] ;
311
313
312
314
debug ! ( "{} '{}'" , cc, args. connect( "' '" ) ) ;
313
- match run:: process_output ( cc, args) {
315
+ let opt_prog = {
316
+ let _guard = io:: ignore_io_error ( ) ;
317
+ run:: process_output ( cc, args)
318
+ } ;
319
+ match opt_prog {
314
320
Some ( prog) => {
315
321
if !prog. status . success ( ) {
316
322
sess. err ( format ! ( "linking with `{}` failed: {}" , cc, prog. status) ) ;
@@ -320,7 +326,7 @@ pub mod write {
320
326
}
321
327
} ,
322
328
None => {
323
- sess. err ( format ! ( "could not exec `{}`" , cc) ) ;
329
+ sess. err ( format ! ( "could not exec the linker `{}`" , cc) ) ;
324
330
sess. abort_if_errors ( ) ;
325
331
}
326
332
}
@@ -948,8 +954,11 @@ fn link_natively(sess: Session, dylib: bool, obj_filename: &Path,
948
954
949
955
// Invoke the system linker
950
956
debug ! ( "{} {}" , cc_prog, cc_args. connect( " " ) ) ;
951
- let opt_prog = time ( sess. time_passes ( ) , "running linker" , ( ) , |( ) |
952
- run:: process_output ( cc_prog, cc_args) ) ;
957
+ let opt_prog = {
958
+ let _guard = io:: ignore_io_error ( ) ;
959
+ time ( sess. time_passes ( ) , "running linker" , ( ) , |( ) |
960
+ run:: process_output ( cc_prog, cc_args) )
961
+ } ;
953
962
954
963
match opt_prog {
955
964
Some ( prog) => {
@@ -961,7 +970,7 @@ fn link_natively(sess: Session, dylib: bool, obj_filename: &Path,
961
970
}
962
971
} ,
963
972
None => {
964
- sess. err ( format ! ( "could not exec `{}`" , cc_prog) ) ;
973
+ sess. err ( format ! ( "could not exec the linker `{}`" , cc_prog) ) ;
965
974
sess. abort_if_errors ( ) ;
966
975
}
967
976
}
0 commit comments