File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,12 @@ cargo_test_options() {
24
24
}
25
25
26
26
cargo_test () {
27
- RUST_BACKTRACE=1 cargo nextest run --profile ci $( cargo_test_options $1 )
27
+ LOG_PATH=$( mktemp)
28
+ tail -f ${LOG_PATH} &
29
+ TAIL_PID=$!
30
+ LOG_UNCAPTURED=${LOG_PATH} RUST_BACKTRACE=1 cargo nextest run --profile ci $( cargo_test_options $1 )
28
31
(( CARGO_RESULT = ${CARGO_RESULT} || $? ))
29
32
mv target/nextest/ci/junit.xml $2
33
+ kill ${TAIL_PID}
34
+ rm ${LOG_PATH}
30
35
}
Original file line number Diff line number Diff line change @@ -525,8 +525,24 @@ pub(crate) fn log_uncaptured<S: AsRef<str>>(text: S) {
525
525
use std:: io:: Write ;
526
526
527
527
let mut stderr = std:: io:: stderr ( ) ;
528
- stderr. write_all ( text. as_ref ( ) . as_bytes ( ) ) . unwrap ( ) ;
529
- stderr. write_all ( b"\n " ) . unwrap ( ) ;
528
+ let mut sinks = vec ! [ & mut stderr as & mut dyn Write ] ;
529
+ let mut other;
530
+ let other_path = std:: env:: var ( "LOG_UNCAPTURED" ) . unwrap_or ( "/dev/tty" . to_string ( ) ) ;
531
+ if let Ok ( f) = std:: fs:: OpenOptions :: new ( ) . append ( true ) . open ( & other_path) {
532
+ other = f;
533
+ sinks. push ( & mut other) ;
534
+ }
535
+
536
+ for sink in sinks {
537
+ sink. write_all ( text. as_ref ( ) . as_bytes ( ) ) . unwrap ( ) ;
538
+ sink. write_all ( b"\n " ) . unwrap ( ) ;
539
+ }
540
+ }
541
+
542
+ #[ test]
543
+ fn log_uncaptured_example ( ) {
544
+ println ! ( "this is captured" ) ;
545
+ log_uncaptured ( "this is not captured" ) ;
530
546
}
531
547
532
548
pub ( crate ) fn file_level_log ( message : impl AsRef < str > ) {
You can’t perform that action at this time.
0 commit comments