on master help sign in
Fit code within 80 characters
commit05dbca5120fcf81f705daad610cdcb963614bbdc authorJustin Leitgeb <justin@stackbuilders.com> dateFri 11 Oct 2013, 09:04 (13 years ago) parent15aec26
1 file changed+10−4
server/Server.hs+10−4
server/Server.hs+10−4
@@ -38,8 +38,10 @@ serveElm :: FilePath -> ServerPartT IO Response
3838serveElm fp = do
3939 guard (takeExtension fp == ".elm")
4040 let file = tail fp
41− args = [ "--make" ,"--runtime=" ++ runtime, "--cache-dir=elm-server-cache", file ]
42− (_, stdout, _, handle) <- liftIO $ createProcess $ (proc "elm" args) { std_out = CreatePipe }
41+ args = [ "--make" ,"--runtime=" ++ runtime,
42+ "--cache-dir=elm-server-cache", file ]
43+ (_, stdout, _, handle) <- liftIO $ createProcess $
44+ (proc "elm" args) { std_out = CreatePipe }
4345 exitCode <- liftIO $ waitForProcess handle
4446 liftIO $ removeDirectoryRecursive "elm-server-cache"
4547 case (exitCode, stdout) of
@@ -49,7 +51,8 @@ serveElm fp = do
4951 (ExitFailure _, Nothing) ->
5052 badRequest $ toResponse "See command line for error message."
5153 (ExitSuccess, _) ->
52− serveFile (asContentType "text/html") ("build" </> replaceExtension file "html")
54+ serveFile
55+ (asContentType "text/html") ("build" </> replaceExtension file "html")
5356
5457serveLib :: FilePath -> [Char] -> ServerPartT IO Response
5558serveLib libLoc fp = do
@@ -73,7 +76,10 @@ parse args =
7376
7477 argValue arg = tail $ dropWhile (/= '=') (head arg)
7578 portNumber = if null portArg then 8000 else read (argValue portArg) :: Int
76− elmRuntime = if null runtimeArg then Elm.runtime else return $ argValue runtimeArg
79+ elmRuntime = if null runtimeArg then
80+ Elm.runtime
81+ else
82+ return $ argValue runtimeArg
7783
7884usageMini :: String
7985usageMini =