From 8252951a510e3bc8427bcb16cca2018cf7b47a02 Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Mon, 25 May 2020 11:26:20 +0100 Subject: [PATCH] WINIO: Add support for WINIO to Cabal. --- Cabal/Distribution/Compat/Internal/TempFile.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Cabal/Distribution/Compat/Internal/TempFile.hs b/Cabal/Distribution/Compat/Internal/TempFile.hs index dee86eb507e..18ec64adaef 100644 --- a/Cabal/Distribution/Compat/Internal/TempFile.hs +++ b/Cabal/Distribution/Compat/Internal/TempFile.hs @@ -40,6 +40,12 @@ import qualified System.Posix -- needs to be changed to make this better. openNewBinaryFile :: FilePath -> String -> IO (FilePath, Handle) openNewBinaryFile dir template = do + -- This method can't be used under WINIO. Also the current implementation has + -- thread safety issues depending on which GHC is used. On newer GHC's let's + -- use the built in one. +#if defined(__IO_MANAGER_WINIO__) + openBinaryTempFile dir template +#else pid <- c_getpid findTempName pid where @@ -95,6 +101,8 @@ pathSeparator = '\\' #else pathSeparator = '/' #endif +-- /* __IO_MANAGER_WINIO__ */ +#endif -- FIXME: Copied from GHC.Handle std_flags, output_flags, rw_flags :: CInt