Browse Source

Remove the Unix domain socket file on exit

master
Peter J. Jones 2 years ago
parent
commit
4e968368c5
Signed by: Peter Jones <pjones@devalot.com> GPG Key ID: 9DAFAA8D01941E49
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      src/lib/Network/XXX/ZigBee/Commander/Internal/Network.hs

+ 7
- 1
src/lib/Network/XXX/ZigBee/Commander/Internal/Network.hs View File

@@ -112,10 +112,16 @@ server = do
112 112
     liftIO $ do
113 113
       path   <- serverSocketName
114 114
       socket <- Network.listenOn (Network.UnixSocket path)
115
-      handler socket `finally` Network.sClose socket
115
+      handler socket `finally` cleanup socket path
116 116
 
117 117
   where
118 118
 
119
+    ----------------------------------------------------------------------------
120
+    cleanup :: Network.Socket -> FilePath -> IO ()
121
+    cleanup socket path = do
122
+      Network.sClose socket
123
+      removeFile path
124
+
119 125
     ----------------------------------------------------------------------------
120 126
     listen :: (MonadIO m) => Network.Socket -> Commander m ()
121 127
     listen socket = do

Loading…
Cancel
Save