mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-20 00:22:51 -06:00
don't save the history in -run and -server modes to avoid space leaks
This commit is contained in:
@@ -94,7 +94,10 @@ readCommand =
|
|||||||
do opts <- gets startOpts
|
do opts <- gets startOpts
|
||||||
case flag optMode opts of
|
case flag optMode opts of
|
||||||
ModeRun -> lift tryGetLine
|
ModeRun -> lift tryGetLine
|
||||||
_ -> lift . fetchCommand =<< get
|
_ -> do gfenv <- get
|
||||||
|
s <- lift (fetchCommand gfenv)
|
||||||
|
put $ gfenv {history = s : history gfenv}
|
||||||
|
return s
|
||||||
|
|
||||||
timeIt act =
|
timeIt act =
|
||||||
do t1 <- liftSIO $ getCPUTime
|
do t1 <- liftSIO $ getCPUTime
|
||||||
@@ -115,13 +118,8 @@ type ShellM = StateT GFEnv SIO
|
|||||||
|
|
||||||
-- | Execute a given command line, returning 'True' to continue execution,
|
-- | Execute a given command line, returning 'True' to continue execution,
|
||||||
-- | 'False' when it is time to quit
|
-- | 'False' when it is time to quit
|
||||||
execute1, execute1' :: ReadNGF -> String -> ShellM Bool
|
execute1 :: ReadNGF -> String -> ShellM Bool
|
||||||
execute1 readNGF s0 =
|
execute1 readNGF s0 =
|
||||||
do modify $ \ gfenv0 -> gfenv0 {history = s0 : history gfenv0}
|
|
||||||
execute1' readNGF s0
|
|
||||||
|
|
||||||
-- | Execute a given command line, without adding it to the history
|
|
||||||
execute1' readNGF s0 =
|
|
||||||
do opts <- gets startOpts
|
do opts <- gets startOpts
|
||||||
interruptible $ optionallyShowCPUTime opts $
|
interruptible $ optionallyShowCPUTime opts $
|
||||||
case pwords s0 of
|
case pwords s0 of
|
||||||
@@ -218,7 +216,7 @@ execute1' readNGF s0 =
|
|||||||
continue
|
continue
|
||||||
where
|
where
|
||||||
execute [] = return ()
|
execute [] = return ()
|
||||||
execute (line:lines) = whenM (execute1' readNGF line) (execute lines)
|
execute (line:lines) = whenM (execute1 readNGF line) (execute lines)
|
||||||
|
|
||||||
execute_history _ =
|
execute_history _ =
|
||||||
do putStrLnE "eh command not parsed"
|
do putStrLnE "eh command not parsed"
|
||||||
|
|||||||
Reference in New Issue
Block a user