@@ -33,6 +33,7 @@ use std::os::consts::{macos, freebsd, linux, android, win32};
3333use std:: ptr;
3434use std:: run;
3535use std:: str;
36+ use std:: io;
3637use std:: io:: fs;
3738use extra:: tempfile:: TempDir ;
3839use syntax:: abi;
@@ -97,6 +98,7 @@ pub mod write {
9798 use util:: common:: time;
9899
99100 use std:: c_str:: ToCStr ;
101+ use std:: io;
100102 use std:: libc:: { c_uint, c_int} ;
101103 use std:: path:: Path ;
102104 use std:: run;
@@ -310,7 +312,11 @@ pub mod write {
310312 assembly. as_str ( ) . unwrap ( ) . to_owned ( ) ] ;
311313
312314 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 {
314320 Some ( prog) => {
315321 if !prog. status . success ( ) {
316322 sess. err ( format ! ( "linking with `{}` failed: {}" , cc, prog. status) ) ;
@@ -320,7 +326,7 @@ pub mod write {
320326 }
321327 } ,
322328 None => {
323- sess. err ( format ! ( "could not exec `{}`" , cc) ) ;
329+ sess. err ( format ! ( "could not exec the linker `{}`" , cc) ) ;
324330 sess. abort_if_errors ( ) ;
325331 }
326332 }
@@ -948,8 +954,11 @@ fn link_natively(sess: Session, dylib: bool, obj_filename: &Path,
948954
949955 // Invoke the system linker
950956 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+ } ;
953962
954963 match opt_prog {
955964 Some ( prog) => {
@@ -961,7 +970,7 @@ fn link_natively(sess: Session, dylib: bool, obj_filename: &Path,
961970 }
962971 } ,
963972 None => {
964- sess. err ( format ! ( "could not exec `{}`" , cc_prog) ) ;
973+ sess. err ( format ! ( "could not exec the linker `{}`" , cc_prog) ) ;
965974 sess. abort_if_errors ( ) ;
966975 }
967976 }
0 commit comments