summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-27 15:33:24 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-27 15:33:24 -0400
commit02ec8ea01254637facb30f77b7cb74be3b735c0d (patch)
tree3ba054919ab49a457c287163d5b41f8f4e3e5678 /Utility
parentbc5b1516175f143f42bda2d12f512768d2df7c9e (diff)
much better webapp startup of the assistant
This avoids forking another process, avoids polling, fixes a race, and avoids a rare forkProcess thread hang that I saw once time when starting the webapp.
Diffstat (limited to 'Utility')
-rw-r--r--Utility/WebApp.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs
index 69864dc6d..75e8dde9e 100644
--- a/Utility/WebApp.hs
+++ b/Utility/WebApp.hs
@@ -32,6 +32,7 @@ import Blaze.ByteString.Builder.Char.Utf8 (fromText)
import Blaze.ByteString.Builder (Builder)
import Data.Monoid
import Control.Arrow ((***))
+import Control.Concurrent
localhost :: String
localhost = "localhost"
@@ -52,12 +53,12 @@ runBrowser url = boolSystem cmd [Param url]
-
- An IO action can also be run, to do something with the port number,
- such as start a web browser to view the webapp.
- -}
+ -}
runWebApp :: Application -> (PortNumber -> IO ()) -> IO ()
runWebApp app observer = do
sock <- localSocket
+ void $ forkIO $ runSettingsSocket defaultSettings sock app
observer =<< socketPort sock
- runSettingsSocket defaultSettings sock app
{- Binds to a local socket, selecting any free port.
-