summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2011-04-20 14:30:49 +0000
committerhallgren <hallgren@chalmers.se>2011-04-20 14:30:49 +0000
commitfd0fb48493063c849c8a3f7d359d0d2c6c66f4ef (patch)
tree96bfad0b33c4b711f52cf55762cd6843ce46d00c
parenta53558aac04b103a1d2ca58c518ae4bfe2ff2c68 (diff)
Ctrl-C shouldn't terminate the GF shell
This quick fix should make Ctrl-C in the GF shell behave more like it does in other shells: even if no command is running, Ctrl-C now just gives you a new prompt instead of terminating the shell.
-rw-r--r--src/compiler/GFI.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/compiler/GFI.hs b/src/compiler/GFI.hs
index 9f312e9dd..58c6df92e 100644
--- a/src/compiler/GFI.hs
+++ b/src/compiler/GFI.hs
@@ -294,10 +294,11 @@ fetchCommand gfenv = do
Haskeline.historyFile = Just path,
Haskeline.autoAddHistory = True
}
- res <- Haskeline.runInputT settings (Haskeline.getInputLine (prompt (commandenv gfenv)))
+ res <- runInterruptibly $ Haskeline.runInputT settings (Haskeline.getInputLine (prompt (commandenv gfenv)))
case res of
- Nothing -> return "q"
- Just s -> return s
+ Left _ -> return ""
+ Right Nothing -> return "q"
+ Right (Just s) -> return s
importInEnv :: GFEnv -> Options -> [FilePath] -> IO GFEnv
importInEnv gfenv opts files