File tree 1 file changed +13
-4
lines changed
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};
72
72
use std:: thread;
73
73
use std:: time:: { Instant , Duration } ;
74
74
use std:: borrow:: Cow ;
75
+ use std:: process;
75
76
76
77
const TEST_WARN_TIMEOUT_S : u64 = 60 ;
77
78
const QUIET_MODE_MAX_COLUMN : usize = 100 ; // insert a '\n' after 100 tests in quiet mode
@@ -266,19 +267,27 @@ impl Options {
266
267
pub fn test_main ( args : & [ String ] , tests : Vec < TestDescAndFn > , options : Options ) {
267
268
let mut opts = match parse_opts ( args) {
268
269
Some ( Ok ( o) ) => o,
269
- Some ( Err ( msg) ) => panic ! ( "{:?}" , msg) ,
270
+ Some ( Err ( msg) ) => {
271
+ eprintln ! ( "error: {}" , msg) ;
272
+ process:: exit ( 101 ) ;
273
+ } ,
270
274
None => return ,
271
275
} ;
276
+
272
277
opts. options = options;
273
278
if opts. list {
274
279
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 ) ;
276
282
}
277
283
} else {
278
284
match run_tests_console ( & opts, tests) {
279
285
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
+ } ,
282
291
}
283
292
}
284
293
}
You can’t perform that action at this time.
0 commit comments