Commit dbf55fa 1 parent 08ab0b0 commit dbf55fa Copy full SHA for dbf55fa
File tree 4 files changed +24
-2
lines changed
4 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,13 @@ fn lazy_start(parent_state: ThreadSafeState) -> ResourceId {
111
111
112
112
let mut runtime = C_RUNTIME . lock ( ) . unwrap ( ) ;
113
113
runtime. spawn ( lazy ( move || {
114
+ // Tokio swallows panics. In order to actually crash when we panic, we
115
+ // have to set this custom hook.
116
+ std:: panic:: set_hook ( Box :: new ( |panic_info| {
117
+ eprintln ! ( "{}" , panic_info. to_string( ) ) ;
118
+ std:: process:: abort ( ) ;
119
+ } ) ) ;
120
+
114
121
worker. then ( move |result| -> Result < ( ) , ( ) > {
115
122
// Close resource so the future created by
116
123
// handle_worker_message_stream exits
Original file line number Diff line number Diff line change 75
75
}
76
76
77
77
fn main ( ) {
78
+ // Tokio swallows panics. In order to actually crash when we panic, we have
79
+ // to set this custom hook.
80
+ std:: panic:: set_hook ( Box :: new ( |panic_info| {
81
+ eprintln ! ( "{}" , panic_info. to_string( ) ) ;
82
+ std:: process:: abort ( ) ;
83
+ } ) ) ;
84
+
78
85
#[ cfg( windows) ]
79
86
ansi_term:: enable_ansi_support ( ) . ok ( ) ; // For Windows 10
80
87
Original file line number Diff line number Diff line change 40
40
let rt = tokio:: runtime:: Runtime :: new ( ) . unwrap ( ) ;
41
41
let mut executor = rt. executor ( ) ;
42
42
let mut enter = tokio_executor:: enter ( ) . expect ( "Multiple executors at once" ) ;
43
- tokio_executor:: with_default ( & mut executor, & mut enter, move |_enter| f ( ) ) ;
43
+ tokio_executor:: with_default ( & mut executor, & mut enter, move |_enter| {
44
+ // Tokio swallows panics. In order to actually crash when we panic, we
45
+ // have to set this custom hook.
46
+ std:: panic:: set_hook ( Box :: new ( |panic_info| {
47
+ eprintln ! ( "{}" , panic_info. to_string( ) ) ;
48
+ std:: process:: abort ( ) ;
49
+ } ) ) ;
50
+ f ( )
51
+ } ) ;
44
52
}
45
53
46
54
#[ derive( Debug ) ]
Original file line number Diff line number Diff line change @@ -324,7 +324,7 @@ mod tests {
324
324
onmessage = function(e) {
325
325
console.log("msg from main script", e.data);
326
326
if (e.data == "exit") {
327
- close() ;
327
+ delete window.onmessage ;
328
328
return;
329
329
} else {
330
330
console.assert(e.data === "hi");
You can’t perform that action at this time.
0 commit comments