From 918a56e896c3a96975301a7f1e0fda0c98de29d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 4 May 2020 13:03:41 +0200 Subject: Add shutdown-hook. --- module/repl.scm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'module/repl.scm') diff --git a/module/repl.scm b/module/repl.scm index a0133403..ae559251 100644 --- a/module/repl.scm +++ b/module/repl.scm @@ -1,6 +1,8 @@ (define-module (repl) :use-module (system repl server) - :use-module (ice-9 regex)) + :use-module (ice-9 regex) + :use-module ((util hooks) :select (shutdown-hook)) + ) (define-public (runtime-dir) (or (getenv "XDG_RUNTIME_DIR") @@ -16,8 +18,11 @@ ;; IPv6 is as of Gulie 2.2 not supported by make-tcp-server-socket. ;; This might be the same problem as I encountered in my html server. [else 'UNIX]) - ;; TODO created unix sockets are newer cleaned up [(UNIX) + (add-hook! shutdown-hook (lambda () (catch 'system-error (lambda () (delete-file address)) + (lambda (err proc fmt . args) + ;; TODO warn here + err)))) (make-unix-domain-server-socket path: address)] [(IPv4) (apply (case-lambda [() (error "Empty address?")] -- cgit v1.2.3