Pass correct arguments on restart
authorunc0rr
Sun, 15 May 2011 18:16:13 +0400
changeset 5210 a5329e52a71b
parent 5209 f7a610e2ef5f
child 5211 8ebf92014447
Pass correct arguments on restart
gameServer/Actions.hs
gameServer/CoreTypes.hs
gameServer/Opts.hs
--- a/gameServer/Actions.hs	Sun May 15 18:10:01 2011 +0400
+++ b/gameServer/Actions.hs	Sun May 15 18:16:13 2011 +0400
@@ -475,11 +475,12 @@
 
 processAction RestartServer = do
     sock <- gets (fromJust . serverSocket . serverInfo)
+    args <- gets (runArgs . serverInfo)
     io $ do
         noticeM "Core" "Closing listening socket"
         sClose sock
         noticeM "Core" "Spawning new server"
-        _ <- createProcess (proc "./hedgewars-server" [])
+        _ <- createProcess (proc "./hedgewars-server" args)
         return ()
     processAction $ ModifyServerInfo (\s -> s{shutdownPending=True})
 
--- a/gameServer/CoreTypes.hs	Sun May 15 18:10:01 2011 +0400
+++ b/gameServer/CoreTypes.hs	Sun May 15 18:16:13 2011 +0400
@@ -129,6 +129,7 @@
         dbPassword :: B.ByteString,
         bans :: [BanInfo],
         shutdownPending :: Bool,
+        runArgs :: [String],
         coreChan :: Chan CoreMessage,
         dbQueries :: Chan DBQuery,
         serverSocket :: Maybe Socket,
@@ -152,6 +153,7 @@
         ""
         []
         False
+        []
 
 data AccountInfo =
     HasAccount B.ByteString Bool
--- a/gameServer/Opts.hs	Sun May 15 18:10:01 2011 +0400
+++ b/gameServer/Opts.hs	Sun May 15 18:16:13 2011 +0400
@@ -34,6 +34,6 @@
 getOpts opts = do
     args <- getArgs
     case getOpt Permute options args of
-        (o, [], []) -> return $ foldr ($) opts o
+        (o, [], []) -> return $ foldr ($) opts{runArgs = args} o
         (_,_,errs) -> ioError (userError (concat errs ++ usageInfo header options))
     where header = "Usage: hedgewars-server [OPTION...]"