From 2ef834a4ba204ae92694132f278d9126fa8df630 Mon Sep 17 00:00:00 2001 From: Maksym Ivanov Date: Mon, 24 Nov 2014 14:08:14 +0200 Subject: [PATCH] add CWD in server status output --- src/Server.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Server.hs b/src/Server.hs index 551e2c4..29fedf5 100644 --- a/src/Server.hs +++ b/src/Server.hs @@ -5,7 +5,7 @@ import Control.Monad (guard) import Data.IORef (IORef, newIORef, readIORef, writeIORef) import GHC.IO.Exception (IOErrorType(ResourceVanished)) import Network (PortID(UnixSocket), Socket, accept, listenOn, sClose) -import System.Directory (removeFile) +import System.Directory (removeFile, getCurrentDirectory) import System.Exit (ExitCode(ExitSuccess)) import System.IO (Handle, hClose, hFlush, hGetLine, hPutStrLn) import System.IO.Error (ioeGetErrorType, isDoesNotExistError) @@ -72,8 +72,10 @@ getNextCommand currentClient sock = do Just (SrvCommand cmd ghcOpts) -> do return $ Just (cmd, ghcOpts) Just SrvStatus -> do + cwd <- getCurrentDirectory mapM_ (clientSend currentClient) $ [ ClientStdout "Server is running." + , ClientStdout ("Server CWD is " ++ cwd) , ClientExit ExitSuccess ] getNextCommand currentClient sock