This repository was archived by the owner on Oct 7, 2020. It is now read-only.
File tree 2 files changed +12
-14
lines changed
src/Haskell/Ide/Engine/Transport
2 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,8 @@ jsonStdioTransport cin = do
37
37
P. runEffect (parseFrames PB. stdin P. >-> parseToJsonPipe cin cout 1 P. >-> jsonConsumer)
38
38
39
39
parseToJsonPipe
40
- :: Chan ChannelRequest
41
- -> Chan ChannelResponse
40
+ :: TChan ChannelRequest
41
+ -> TChan ChannelResponse
42
42
-> Int
43
43
-> P. Pipe (Either PAe. DecodingError WireRequest ) A. Value IO ()
44
44
parseToJsonPipe cin cout cid =
@@ -53,8 +53,8 @@ parseToJsonPipe cin cout cid =
53
53
T. pack $ " jsonStdioTransport:parse error:" ++ show decodeErr
54
54
P. yield $ A. toJSON $ channelToWire rsp
55
55
Right req ->
56
- do liftIO $ writeChan cin (wireToChannel cout cid req)
57
- rsp <- liftIO $ readChan cout
56
+ do liftIO $ atomically $ writeTChan cin (wireToChannel cout cid req)
57
+ rsp <- liftIO $ atomically $ readTChan cout
58
58
P. yield $ A. toJSON $ channelToWire rsp
59
59
parseToJsonPipe cin
60
60
cout
Original file line number Diff line number Diff line change @@ -232,16 +232,14 @@ dispatcherSpec = do
232
232
r2 <- withStdoutLogging $ runIdeM (IdeState Map. empty) (doDispatch (testPlugins chSync) cr2)
233
233
r1 `shouldBe` Nothing
234
234
r2 `shouldBe` Nothing
235
- yield
236
- rc1 <- atomically $ tryReadTChan chan
237
- yield
238
- rc2 <- atomically $ tryReadTChan chan
239
- rc1 `shouldBe` Just (CResp { couPlugin = " test"
240
- , coutReqId = 2
241
- , coutResp = IdeResponseOk (HM. fromList [(" response" ,String " asyncCmd2 sent strobe" )])})
242
- rc2 `shouldBe` Just (CResp { couPlugin = " test"
243
- , coutReqId = 1
244
- , coutResp = IdeResponseOk (HM. fromList [(" response" ,String " asyncCmd1 got strobe" )])})
235
+ rc1 <- atomically $ readTChan chan
236
+ rc2 <- atomically $ readTChan chan
237
+ rc1 `shouldBe` (CResp { couPlugin = " test"
238
+ , coutReqId = 2
239
+ , coutResp = IdeResponseOk (HM. fromList [(" response" ,String " asyncCmd2 sent strobe" )])})
240
+ rc2 `shouldBe` (CResp { couPlugin = " test"
241
+ , coutReqId = 1
242
+ , coutResp = IdeResponseOk (HM. fromList [(" response" ,String " asyncCmd1 got strobe" )])})
245
243
246
244
-- ---------------------------------------------------------------------
247
245
You can’t perform that action at this time.
0 commit comments