Skip to content

Commit

Permalink
Reduce #ifdef to OpenHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
jneira committed Mar 17, 2022
1 parent 125ee6f commit f710e50
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cabal-testsuite/src/Test/Cabal/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -250,19 +250,17 @@ startServer chan senv = do
initServer :: Server -> IO Server
initServer s0 = do
-- NB: withProcessHandle reads an MVar and is interruptible
#if mingw32_HOST_OS

pid <- withProcessHandle (serverProcessHandle s0) $ \ph ->
case ph of
#if mingw32_HOST_OS
OpenHandle x -> fmap show (Win32.getProcessId x)
-- TODO: handle OpenExtHandle?
_ -> return (serverProcessId s0)
#else
pid <- withProcessHandle (serverProcessHandle s0) $ \ph ->
case ph of
OpenHandle x -> return (show x)
#endif
-- TODO: handle OpenExtHandle?
_ -> return (serverProcessId s0)
#endif

let s = s0 { serverProcessId = pid }
-- We will read/write a line at a time, including for
-- output; our demarcation tokens are an entire line.
Expand Down

0 comments on commit f710e50

Please sign in to comment.