Skip to content

Instantly share code, notes, and snippets.

@CRTified
Created January 9, 2020 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CRTified/09a657976a357a509ec3d0cf3f7e581d to your computer and use it in GitHub Desktop.
Save CRTified/09a657976a357a509ec3d0cf3f7e581d to your computer and use it in GitHub Desktop.
bracket
(do
sock <- socket AF_UNIX Stream 0
setSocketOption sock ReuseAddr 1
bind sock $ SockAddrUnix s
listen sock maxListenQueue
return sock
)
(\sock -> do
sockhandle <- socketToHandle sock ReadWriteMode
hClose sockhandle
)
(\sock -> Network.Wai.Handler.Warp.runSettingsSocket warpsettings sock app)
[nix-shell:~/git/hub/hledger]$ stack exec -- hledger-web --socket /tmp/foo.sock
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
09/Jan/2020:16:27:16 +0100 [Info#yesod-core] Application launched @(yesod-core-1.6.17-8khiymix0izHkaDEW7detY:Yesod.Core.Dispatch src/Yesod/Core/Dispatch.hs:163:11)
Serving web UI and API on 127.0.0.1:5000 with base url http://127.0.0.1:5000
Press ctrl-c to quit
^C
[nix-shell:~/git/hub/hledger]$ stack exec -- hledger-web --socket /tmp/foo.sock
Stack has not been tested with GHC versions above 8.6, and using 8.8.1, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.0.0 was found, this may fail
09/Jan/2020:16:27:25 +0100 [Info#yesod-core] Application launched @(yesod-core-1.6.17-8khiymix0izHkaDEW7detY:Yesod.Core.Dispatch src/Yesod/Core/Dispatch.hs:163:11)
Serving web UI and API on 127.0.0.1:5000 with base url http://127.0.0.1:5000
Press ctrl-c to quit
hledger-web: Network.Socket.bind: resource busy (Address already in use)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment