import qualified Control.Exception as Exception
import Data.Maybe
-import Data.Bits
import Data.Char ( isSpace, toLower )
import Control.Monad
import System.Directory ( doesDirectoryExist, getDirectoryContents,
import Data.List
import Control.Concurrent
+import Foreign
import Foreign.C
#ifdef mingw32_HOST_OS
-import Foreign
import GHC.ConsoleHandler
#else
import System.Posix hiding (fdToHandle)
-- XXX We want to tell fdToHandle what the filepath is,
-- as any exceptions etc will only be able to report the
-- fd currently
- h <- fdToHandle fd `onException` c_close fd
+ h <-
+#if __GLASGOW_HASKELL__ >= 609
+ fdToHandle fd
+#else
+ fdToHandle (fromIntegral fd)
+#endif
+ `onException` c_close fd
return (filepath, h)
where
filename = prefix ++ show x ++ suffix