I think I have a misunderstanding on the behavior of custodians. I'm trying to write a Racket program that shuts down any subprocesses it may have created when the program exits, regardless of whether the exit was graceful.
I would have thought that the root custodian would have taken care of this, but it appears not. Consider the following program: ;; kill-test.rkt #lang racket (parameterize ([current-subprocess-custodian-mode 'kill]) (subprocess #f #f #f (find-executable-path "racket") "sleep.rkt")) ;;(custodian-shutdown-all (current-custodian)) ----------- sleep.rkt is just a Racket program that sleeps for 5 minutes, then exits. if I run kill-test.rkt as-is, it immediately exits, but sleep.rkt continues to run for 5 minutes. However, if I uncomment the custodian-shutdown-all line, the subprocess is killed immediately when kill-test exits. Also, if I halt the program with Ctrl-C before it exits (say, if I inserted a sleep at the end), the subprocess is killed without the manual call to custodian-shutdown-all. My assumption was that the root custodian would always call custodian-shutdown-all on itself when a Racket process ends, regardless of whether the process is shutting down gracefully or not. Is that not the case?
____________________ Racket Users list: http://lists.racket-lang.org/users