File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ use std::sync::{Arc, Mutex};
7272use std:: thread;
7373use std:: time:: { Instant , Duration } ;
7474use std:: borrow:: Cow ;
75+ use std:: process;
7576
7677const TEST_WARN_TIMEOUT_S : u64 = 60 ;
7778const QUIET_MODE_MAX_COLUMN : usize = 100 ; // insert a '\n' after 100 tests in quiet mode
@@ -266,19 +267,27 @@ impl Options {
266267pub fn test_main ( args : & [ String ] , tests : Vec < TestDescAndFn > , options : Options ) {
267268 let mut opts = match parse_opts ( args) {
268269 Some ( Ok ( o) ) => o,
269- Some ( Err ( msg) ) => panic ! ( "{:?}" , msg) ,
270+ Some ( Err ( msg) ) => {
271+ eprintln ! ( "error: {}" , msg) ;
272+ process:: exit ( 101 ) ;
273+ } ,
270274 None => return ,
271275 } ;
276+
272277 opts. options = options;
273278 if opts. list {
274279 if let Err ( e) = list_tests_console ( & opts, tests) {
275- panic ! ( "io error when listing tests: {:?}" , e) ;
280+ eprintln ! ( "error: io error when listing tests: {:?}" , e) ;
281+ process:: exit ( 101 ) ;
276282 }
277283 } else {
278284 match run_tests_console ( & opts, tests) {
279285 Ok ( true ) => { }
280- Ok ( false ) => std:: process:: exit ( 101 ) ,
281- Err ( e) => panic ! ( "io error when running tests: {:?}" , e) ,
286+ Ok ( false ) => process:: exit ( 101 ) ,
287+ Err ( e) => {
288+ eprintln ! ( "error: io error when listing tests: {:?}" , e) ;
289+ process:: exit ( 101 ) ;
290+ } ,
282291 }
283292 }
284293}
You can’t perform that action at this time.
0 commit comments