Quit ncurses before printing stack trace, idea from Kooda - holymoly - A tor enabled gopher client written in CHICKEN scheme
(HTM) git clone git://vernunftzentrum.de/holymoly.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 6ce1e49ab2c1d57d67c93165ce029de812267e3e
(DIR) parent 8b316d28eaa854bb72827300ce9b621a13834540
(HTM) Author: Christian Kellermann <ckeen@pestilenz.org>
Date: Wed, 15 Aug 2018 09:34:19 +0200
Quit ncurses before printing stack trace, idea from Kooda
Diffstat:
holymoly.scm | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/holymoly.scm b/holymoly.scm
@@ -362,7 +362,16 @@
(import (only (chicken process-context) command-line-arguments)
+ (only (chicken format) fprintf)
+ (only (chicken condition) signal)
holymoly
(only ncurses endwin))
-(exit-handler (lambda code (endwin)))
-(main (command-line-arguments))
-\ No newline at end of file
+(handle-exceptions exn
+ (begin
+ (on-exit void)
+ ;; Disable ncurses before printing the error message and call trace
+ (endwin)
+ (fprintf (current-error-port) "Exception caught: ~s" exn)
+ (signal exn))
+ (on-exit endwin)
+ (main (command-line-arguments)))
+\ No newline at end of file