File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -79,10 +79,11 @@ pub fn ctrl_c() -> impl FnOnce() + Send + 'static {
7979 let subscribers = CTRL_C_SUBSCRIBERS . get_or_init ( || {
8080 ctrlc:: set_handler ( || {
8181 if let Some ( subs) = CTRL_C_SUBSCRIBERS . get ( ) {
82- if let Ok ( guard) = subs. lock ( ) {
83- for tx in guard. iter ( ) {
84- let _ = tx. send ( ( ) ) ;
85- }
82+ let guard = subs
83+ . lock ( )
84+ . unwrap_or_else ( |poisoned| poisoned. into_inner ( ) ) ;
85+ for tx in guard. iter ( ) {
86+ let _ = tx. send ( ( ) ) ;
8687 }
8788 }
8889 } )
@@ -92,9 +93,10 @@ pub fn ctrl_c() -> impl FnOnce() + Send + 'static {
9293
9394 // Create a new subscriber channel
9495 let ( tx, rx) = std_mpsc:: channel ( ) ;
95- if let Ok ( mut guard) = subscribers. lock ( ) {
96- guard. push ( tx) ;
97- }
96+ subscribers
97+ . lock ( )
98+ . unwrap_or_else ( |poisoned| poisoned. into_inner ( ) )
99+ . push ( tx) ;
98100
99101 move || {
100102 let _ = rx. recv ( ) ;
You can’t perform that action at this time.
0 commit comments