>From 5e4195073e46794e0127435bad53a0c4947e7b91 Mon Sep 17 00:00:00 2001 From: Kooda Date: Sat, 19 Mar 2016 13:21:43 +0100 Subject: [PATCH] Fix bug #1269 --- posixunix.scm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/posixunix.scm b/posixunix.scm index f56960d..bae028d 100644 --- a/posixunix.scm +++ b/posixunix.scm @@ -1576,6 +1576,12 @@ EOF (let ((pid (fork))) (when (fx= -1 pid) (posix-error #:process-error 'process-fork "cannot create child process")) + ;; exit the child process gracefully when (exit) is called + (##sys#exit-handler + (lambda (#!optional (code 0)) + ((foreign-lambda int "fflush" c-pointer) #f) ;; flush all output buffers + (##sys#cleanup-before-exit) + ((foreign-lambda void "_exit" int) code))) (if (and thunk (zero? pid)) ((if killothers ##sys#kill-other-threads -- 2.1.4