@@ -44,7 +44,7 @@ This is a bug. Please report it at:
4444fn panic_hook ( info : & PanicInfo ) {
4545 let message = panic_message ( info) ;
4646 eprintln ! ( "{}" , message) ;
47- exit_on_debug_mode ( ) ;
47+ exit_on_debug_or_env_set_on_release ( ) ;
4848}
4949
5050fn panic_hook_with_email_alarm ( email_alarm : & EmailAlarm , info : & PanicInfo ) {
@@ -54,7 +54,7 @@ fn panic_hook_with_email_alarm(email_alarm: &EmailAlarm, info: &PanicInfo) {
5454
5555 let message_for_email = message. replace ( "\n " , "<br>" ) ;
5656 email_alarm. send ( & format ! ( "IP: {}<br>{}" , ip_addresses, message_for_email) ) ;
57- exit_on_debug_mode ( ) ;
57+ exit_on_debug_or_env_set_on_release ( ) ;
5858}
5959
6060fn panic_message ( info : & PanicInfo ) -> String {
@@ -89,12 +89,16 @@ fn panic_message(info: &PanicInfo) -> String {
8989}
9090
9191#[ cfg( debug_assertions) ]
92- fn exit_on_debug_mode ( ) {
92+ fn exit_on_debug_or_env_set_on_release ( ) {
9393 std:: process:: exit ( -1 ) ;
9494}
9595
9696#[ cfg( not( debug_assertions) ) ]
97- fn exit_on_debug_mode ( ) { }
97+ fn exit_on_debug_or_env_set_on_release ( ) {
98+ if ( std:: env:: var ( "EXIT_ON_CRASH" ) . is_ok ( ) ) {
99+ std:: process:: exit ( -1 ) ;
100+ }
101+ }
98102
99103fn get_ip_addresses ( ) -> String {
100104 match my_internet_ip:: get ( ) {
0 commit comments