My Racket GUI application needs to do a lot of cleanup work when exiting, i.e. when the user presses the X button. These include killing child processes (which isn't automatic on Windows) etc.
Wrapping the .rkt in a shell script which waits and then does the cleanup is a bit too hacky for me. There are many exit handlers in the Racket documentation (exit-handler etc) but none of them seem to work!
You probably want to augment on-close
in frame%
, for example:
#lang racket/gui
(send
(new (class frame% (super-new)
(define/augment (on-close)
(displayln "Exiting...")))
[label "Frame"]
[width 400] [height 200])
show #t)
which on my machine prints "Exiting..." when I click the closing cross.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With