Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ main = do
inh <- getGhcHandle rfd2
outh <- getGhcHandle wfd1
installSignalHandlers
lo_ref <- newIORef Nothing
let in_pipe = Pipe{pipeRead = inh, pipeWrite = outh, pipeLeftovers = lo_ref}
in_pipe <- mkPipeFromHandles inh outh

when verbose $
trace ("Trying to connect to " ++ host_ip ++ ":" ++ (show port))
Expand Down Expand Up @@ -307,5 +306,4 @@ socketToPipe sock = do
hdl <- socketToHandle sock ReadWriteMode
hSetBuffering hdl NoBuffering

lo_ref <- newIORef Nothing
pure Pipe{ pipeRead = hdl, pipeWrite = hdl, pipeLeftovers = lo_ref }
mkPipeFromHandles hdl hdl
1 change: 1 addition & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
packages: .
allow-newer: *
6 changes: 2 additions & 4 deletions iserv-proxy.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ Library
directory >= 1.3 && < 1.4,
network >= 2.6,
filepath >= 1.4 && < 1.5,
ghci == 9.3,
libiserv == 9.3
ghci

Executable iserv-proxy
Default-Language: Haskell2010
Expand All @@ -92,8 +91,7 @@ Executable iserv-proxy
directory >= 1.3 && < 1.4,
network >= 2.6,
filepath >= 1.4 && < 1.5,
ghci == 9.3,
libiserv == 9.3,
ghci,
iserv-proxy

Executable iserv-proxy-interpreter
Expand Down
13 changes: 13 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

# Simple script to build and start the proxy. The printed args show how to use
# it for testing a cross-compiler on the same machine.

set -e

GHC="${GHC:-ghc}"
port=5005

cabal build -w "$GHC" exe:iserv-proxy
echo ghc-args: -fexternal-interpreter -pgmi=$(cabal list-bin -w "$GHC" exe:iserv-proxy) -opti=127.0.0.1 -opti=$port
cabal run -w "$GHC" iserv-proxy-interpreter $port .
5 changes: 3 additions & 2 deletions src/IServ/Remote/Interpreter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ module IServ.Remote.Interpreter where

import Network.Socket

import IServ (serv)
import GHCi.Server (serv)
import GHCi.Message
import IServ.Remote.Message

import System.IO
Expand Down Expand Up @@ -153,7 +154,7 @@ socketToPipe sock = do
hSetBuffering hdl NoBuffering

lo_ref <- newIORef Nothing
pure Pipe{ pipeRead = hdl, pipeWrite = hdl, pipeLeftovers = lo_ref }
mkPipeFromHandles hdl hdl

acceptSocket :: Socket -> IO Socket
acceptSocket = fmap fst . accept