@@ -12,8 +12,7 @@ use std::env;
1212use std:: fmt;
1313use std:: fs:: { self , File } ;
1414use std:: hash;
15- use std:: io:: Read ;
16- use std:: io:: Write ;
15+ use std:: io:: { BufRead , Read , Write } ;
1716use std:: mem:: ManuallyDrop ;
1817use std:: path:: { Path , PathBuf } ;
1918use std:: process:: { self , Command } ;
@@ -1144,7 +1143,22 @@ impl<'a> Processor for ProfileProcessor<'a> {
11441143 let tmp_eprintln_file = filepath ( data. cwd . as_ref ( ) , "eprintln" ) ;
11451144 let eprintln_file = filepath ( self . output_dir , & out_file ( "eprintln" ) ) ;
11461145
1147- fs:: copy ( & tmp_eprintln_file, & eprintln_file) ?;
1146+ let mut final_file =
1147+ std:: io:: BufWriter :: new ( std:: fs:: File :: create ( & eprintln_file) ?) ;
1148+ for line in
1149+ std:: io:: BufReader :: new ( std:: fs:: File :: open ( & tmp_eprintln_file) ?) . lines ( )
1150+ {
1151+ let line = line?;
1152+ // rustc under Cargo currently ~always emits artifact
1153+ // messages -- which we don't want in final
1154+ // eprintln output. These messages generally look like:
1155+ // {"artifact":"/tmp/.tmpjIe45J/...","emit":"dep-info"}
1156+ if line. starts_with ( r#"{"artifact":"# ) {
1157+ continue ;
1158+ }
1159+
1160+ writeln ! ( & mut final_file, "{}" , line) ?;
1161+ }
11481162 }
11491163
11501164 // mono item results are redirected (via rustc-fake) to a file
0 commit comments