diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -72,11 +72,14 @@
 tryCompile :: String -> BuildInfo -> LocalBuildInfo -> Verbosity -> IO Bool
 tryCompile program bi lbi verb = handle processExit $ handle processException $ do
     tempDir <- getTemporaryDirectory
-    withTempFile tempDir ".c" $ \fname h -> do
-        hPutStr h program
-        hClose h
+    withTempFile tempDir ".c" $ \fname cH ->
+      withTempFile tempDir "" $ \execName oH -> do
+        hPutStr cH program
+        hClose cH
+        hClose oH
         -- TODO take verbosity from the args.
-        rawSystemProgramStdoutConf verb gccProgram (withPrograms lbi) (fname : args)
+        rawSystemProgramStdoutConf verb gccProgram (withPrograms lbi)
+                        (fname : "-o" : execName : args)
         return True
   where
     processException :: IOException -> IO Bool
diff --git a/System/Console/Haskeline/Backend/DumbTerm.hs b/System/Console/Haskeline/Backend/DumbTerm.hs
--- a/System/Console/Haskeline/Backend/DumbTerm.hs
+++ b/System/Console/Haskeline/Backend/DumbTerm.hs
@@ -7,6 +7,7 @@
 
 import System.IO
 import qualified Data.ByteString as B
+import Control.Concurrent.Chan
 
 -- TODO: 
 ---- Put "<" and ">" at end of term if scrolls off.
@@ -31,13 +32,15 @@
     lift = DumbTerm . lift . lift . lift
 
 runDumbTerm :: IO RunTerm
-runDumbTerm = posixRunTerm $ \enc h ->
+runDumbTerm = do
+    ch <- newChan
+    posixRunTerm $ \enc h ->
                 TermOps {
                         getLayout = tryGetLayouts (posixLayouts h),
                         runTerm = \f -> 
                                 runPosixT enc h $ evalStateT' initWindow
                                 $ unDumbTerm
-                                $ withPosixGetEvent enc [] f
+                                $ withPosixGetEvent ch enc [] f
                         }
                                 
 instance (MonadException m, MonadLayout m) => Term (DumbTerm m) where
diff --git a/System/Console/Haskeline/Backend/Posix.hsc b/System/Console/Haskeline/Backend/Posix.hsc
--- a/System/Console/Haskeline/Backend/Posix.hsc
+++ b/System/Console/Haskeline/Backend/Posix.hsc
@@ -164,12 +164,11 @@
 -----------------------------
 
 withPosixGetEvent :: (MonadTrans t, MonadIO m, MonadException (t m), MonadReader Prefs m) 
-                        => Encoders -> [(String,Key)] -> (t m Event -> t m a) -> t m a
-withPosixGetEvent enc termKeys f = do
+                        => Chan Event -> Encoders -> [(String,Key)] -> (t m Event -> t m a) -> t m a
+withPosixGetEvent eventChan enc termKeys f = do
     baseMap <- lift $ getKeySequences termKeys
-    evenChan <- liftIO $ newChan
-    withWindowHandler evenChan
-        $ f $ liftIO $ getEvent enc baseMap evenChan
+    withWindowHandler eventChan
+        $ f $ liftIO $ getEvent enc baseMap eventChan
 
 withWindowHandler :: MonadException m => Chan Event -> m a -> m a
 withWindowHandler eventChan = withHandler windowChange $ 
diff --git a/System/Console/Haskeline/Backend/Terminfo.hs b/System/Console/Haskeline/Backend/Terminfo.hs
--- a/System/Console/Haskeline/Backend/Terminfo.hs
+++ b/System/Console/Haskeline/Backend/Terminfo.hs
@@ -11,6 +11,7 @@
 import qualified Control.Exception.Extensible as Exception
 import qualified Data.ByteString.Char8 as B
 import Data.Maybe (fromMaybe, catMaybes)
+import Control.Concurrent.Chan
 
 import System.Console.Haskeline.Monads as Monads
 import System.Console.Haskeline.LineState
@@ -108,6 +109,7 @@
 runTerminfoDraw :: IO (Maybe RunTerm)
 runTerminfoDraw = do
     mterm <- Exception.try setupTermFromEnv
+    ch <- newChan
     case mterm of
         -- XXX narrow this: either an ioexception (from getenv) or a 
         -- usererror.
@@ -125,7 +127,7 @@
                               $ runReaderT' actions
                               $ unDraw
                               $ wrapKeypad h term
-                              $ withPosixGetEvent enc (terminfoKeys term) f
+                              $ withPosixGetEvent ch enc (terminfoKeys term) f
                     }
 
 -- If the keypad on/off capabilities are defined, wrap the computation with them.
diff --git a/System/Console/Haskeline/Backend/Win32.hsc b/System/Console/Haskeline/Backend/Win32.hsc
--- a/System/Console/Haskeline/Backend/Win32.hsc
+++ b/System/Console/Haskeline/Backend/Win32.hsc
@@ -41,8 +41,8 @@
         $ c_GetNumberOfConsoleInputEvents h numEventsPtr
     fmap fromEnum $ peek numEventsPtr
 
-getEvent :: HANDLE -> IO Event
-getEvent h = newChan >>= keyEventLoop (eventReader h)
+getEvent :: HANDLE -> Chan Event -> IO Event
+getEvent h = keyEventLoop (eventReader h)
 
 eventReader :: HANDLE -> IO [Event]
 eventReader h = do
@@ -312,17 +312,19 @@
             oterm <- getConOut
             case oterm of
                 Nothing -> return fileRT
-                Just h -> return fileRT {
+                Just h -> do
+                        ch <- newChan
+                        return fileRT {
                             wrapInterrupt = withWindowMode . withCtrlCHandler,
                             termOps = Just TermOps {
                                             getLayout = getBufferSize h,
-                                            runTerm = consoleRunTerm h},
+                                            runTerm = consoleRunTerm h ch},
                             closeTerm = closeHandle h}
 
-consoleRunTerm :: HANDLE -> RunTermType
-consoleRunTerm conOut f = do
+consoleRunTerm :: HANDLE -> Chan Event -> RunTermType
+consoleRunTerm conOut eventChan f = do
     inH <- liftIO $ getStdHandle sTD_INPUT_HANDLE
-    runReaderT' conOut $ runDraw $ f $ liftIO $ getEvent inH
+    runReaderT' conOut $ runDraw $ f $ liftIO $ getEvent inH eventChan
 
 -- stdin is not a terminal, but we still need to check the right way to output unicode to stdout.
 fileRunTerm :: IO RunTerm
diff --git a/haskeline.cabal b/haskeline.cabal
--- a/haskeline.cabal
+++ b/haskeline.cabal
@@ -1,6 +1,6 @@
 Name:           haskeline
 Cabal-Version:  >=1.6
-Version:        0.6.1.5
+Version:        0.6.1.6
 Category:       User Interfaces
 License:        BSD3
 License-File:   LICENSE
