Handle socket exception gracefully.

This commit is contained in:
Michiel Borkent 2020-10-21 16:53:52 +02:00
parent df334946b9
commit 02cef05574

View file

@ -244,9 +244,11 @@
(Socket. hostname port))
(defn close-socket
"Close the socket, and also closes its input and output streams."
"Close the socket, and also closes its input and output streams. Returns nil."
[^Socket socket]
(.close socket))
(try (.close socket)
nil
(catch java.net.SocketException _ nil)))
(defn port-file [pid]
(io/file (str ".babashka-pod-" pid ".port")))