File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed
Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -262,6 +262,7 @@ To generate [gcov-based](https://github.com/mozilla/grcov#example-how-to-generat
262262export CARGO_INCREMENTAL=0
263263export RUSTFLAGS=" -Cinstrument-coverage -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
264264export RUSTDOCFLAGS=" -Cpanic=abort"
265+ export RUSTUP_TOOLCHAIN=" nightly"
265266cargo build < options...> # e.g., --features feat_os_unix
266267cargo test < options...> # e.g., --features feat_os_unix test_pathchk
267268grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing --ignore build.rs --excl-br-line " ^\s*((debug_)?assert(_eq|_ne)?\#\[derive\()" -o ./target/debug/coverage/
Original file line number Diff line number Diff line change @@ -263,7 +263,14 @@ fn wait_or_kill_process(
263263 match process. wait_or_timeout ( duration, None ) {
264264 Ok ( Some ( status) ) => {
265265 if preserve_status {
266- Ok ( status. code ( ) . unwrap_or_else ( || status. signal ( ) . unwrap ( ) ) )
266+ let exit_code = status. code ( ) . unwrap_or_else ( || {
267+ status. signal ( ) . unwrap_or_else ( || {
268+ // Extremely rare: process exited but we have neither exit code nor signal.
269+ // This can happen on some platforms or in unusual termination scenarios.
270+ ExitStatus :: TimeoutFailed . into ( )
271+ } )
272+ } ) ;
273+ Ok ( exit_code)
267274 } else {
268275 Ok ( ExitStatus :: TimeoutFailed . into ( ) )
269276 }
@@ -351,10 +358,14 @@ fn timeout(
351358 // structure of `wait_or_kill_process()`. They can probably be
352359 // refactored into some common function.
353360 match process. wait_or_timeout ( duration, Some ( & SIGNALED ) ) {
354- Ok ( Some ( status) ) => Err ( status
355- . code ( )
356- . unwrap_or_else ( || preserve_signal_info ( status. signal ( ) . unwrap ( ) ) )
357- . into ( ) ) ,
361+ Ok ( Some ( status) ) => {
362+ let exit_code = status. code ( ) . unwrap_or_else ( || {
363+ status
364+ . signal ( )
365+ . map_or_else ( || ExitStatus :: TimeoutFailed . into ( ) , preserve_signal_info)
366+ } ) ;
367+ Err ( exit_code. into ( ) )
368+ }
358369 Ok ( None ) => {
359370 report_if_verbose ( signal, & cmd[ 0 ] , verbose) ;
360371 send_signal ( process, signal, foreground) ;
You can’t perform that action at this time.
0 commit comments