Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ main = do
hSetBuffering stdout LineBuffering

args <- getArgs
(wfd1, rfd2, host_ip, port, rest) <-
(outh, inh, host_ip, port, rest) <-
case args of
arg0:arg1:arg2:arg3:rest -> do
let wfd1 = read arg0
rfd2 = read arg1
ip = arg2
outh <- readGhcHandle arg0
inh <- readGhcHandle arg1
let ip = arg2
port = read arg3
return (wfd1, rfd2, ip, port, rest)
return (outh, inh, ip, port, rest)
_ -> dieWithUsage

let verbose = "-v" `elem` rest
Expand All @@ -105,10 +105,7 @@ main = do
dieWithUsage

when verbose $
printf "GHC iserv starting (in: %d; out: %d)\n"
Copy link
Author

@alexfmpe alexfmpe Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old: GHC iserv starting (in: 79; out: 78)
New: GHC iserv starting (in: {handle: <file descriptor: 79>}; out: {handle: <file descriptor: 78>})

Is preserving the old behavior on unix worth CPP?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexfmpe you mean the output only? I don't think it is. Iserv-proxy and interpreter are primarily for functionality. I hope that with the cross support in ghc we can setup proper testing here.

(fromIntegral rfd2 :: Int) (fromIntegral wfd1 :: Int)
inh <- getGhcHandle rfd2
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getGhcHandle on windows is HANDLE -> IO Handle where HANDLE = Ptr () rather than CInt -> IO Handle on unix

readGhcHandle handles both cases

outh <- getGhcHandle wfd1
printf "GHC iserv starting (in: %s; out: %s)\n" (show inh) (show outh)
installSignalHandlers
#if MIN_VERSION_ghci(9,13,0)
in_pipe <- mkPipeFromHandles inh outh
Expand Down