Andrea Vezzosi pushed to branch wip/romes/async-rpc at Glasgow Haskell Compiler / GHC
Commits:
-
76c49a91
by Andrea Vezzosi at 2026-11-16T09:54:07+01:00
1 changed file:
Changes:
| ... | ... | @@ -16,6 +16,7 @@ import System.IO |
| 16 | 16 | import Control.Concurrent (rtsSupportsBoundThreads)
|
| 17 | 17 | import GHC.IO.Handle.Windows (handleToHANDLE)
|
| 18 | 18 | import GHC.IO.SubSystem (isWindowsNativeIO)
|
| 19 | +import System.Process.CommunicationHandle.Internal (CommunicationHandle(..))
|
|
| 19 | 20 | import qualified System.Win32 as Win32
|
| 20 | 21 | #endif
|
| 21 | 22 | |
| ... | ... | @@ -30,8 +31,8 @@ runWithPipes createProc prog pre_opts opts = do |
| 30 | 31 | (chTheyRead, wh) <- fixedCreateTheyReadWeWritePipe
|
| 31 | 32 | let args = pre_opts ++ (show chTheyWrite : show chTheyRead : opts)
|
| 32 | 33 | closeTheirs = do
|
| 33 | - closeCommunicationHandle chTheyWrite
|
|
| 34 | - closeCommunicationHandle chTheyRead
|
|
| 34 | + closeTheirEnd chTheyWrite
|
|
| 35 | + closeTheirEnd chTheyRead
|
|
| 35 | 36 | -- These handles have no finalizers, so close them ourselves if the spawn fails.
|
| 36 | 37 | ph <- createProc (proc prog args)
|
| 37 | 38 | `onException` (closeTheirs >> hClose rh >> hClose wh)
|
| ... | ... | @@ -74,3 +75,10 @@ toFdHandleIfNeeded h |
| 74 | 75 | #else
|
| 75 | 76 | toFdHandleIfNeeded = return
|
| 76 | 77 | #endif
|
| 78 | + |
|
| 79 | +closeTheirEnd :: CommunicationHandle -> IO ()
|
|
| 80 | +#if defined(mingw32_HOST_OS)
|
|
| 81 | +closeTheirEnd (CommunicationHandle h) = Win32.closeHandle h
|
|
| 82 | +#else
|
|
| 83 | +closeTheirEnd = closeCommunicationHandle
|
|
| 84 | +#endif |