Andrea Vezzosi pushed to branch wip/romes/async-rpc at Glasgow Haskell Compiler / GHC

Commits:

1 changed file:

Changes:

  • libraries/ghci/GHCi/Message/Async.hs
    ... ... @@ -598,9 +598,8 @@ drainPipe p unmask = catch loop (void . replyToPendings) where
    598 598
                 Just q  -> writeTQueue q (uq,bs)
    
    599 599
         Cancel uq -> cancelRequest am uq
    
    600 600
     
    
    601
    -  replyToPendings e = do
    
    602
    -    atomically $ failPendingReplies p e
    
    603
    -    pipeCloseRead p `catch` \(_ :: IOException) -> pure ()
    
    601
    +  replyToPendings e = finally (pipeCloseRead p `catch` \(_ :: IOException) -> pure ()) -- TODO: log with verbose.
    
    602
    +    . atomically $ failPendingReplies p e
    
    604 603
     
    
    605 604
       am = pipeAsyncMngr p
    
    606 605
     
    
    ... ... @@ -669,8 +668,8 @@ fillPipe p unmask = loop `catch` cleanup Nothing where
    669 668
     
    
    670 669
       am = pipeAsyncMngr p
    
    671 670
     
    
    672
    -  cleanup last_write e0 = do
    
    673
    -    atomically $ do
    
    671
    +  cleanup last_write e0 = finally (pipeCloseWrite p `catch` \(_ :: IOException) -> pure ()) -- TODO: log with verbose
    
    672
    +    . atomically $ do
    
    674 673
           -- deactivate here too so we keep track of the exception if end still 'Open'.
    
    675 674
           s <- deactivatePipeEnd (pipeWriteStatus p) (Just e0)
    
    676 675
           case last_write of
    
    ... ... @@ -680,7 +679,6 @@ fillPipe p unmask = loop `catch` cleanup Nothing where
    680 679
               putTMVar var . Left $ if isOpen s then e0 else toException PipeWriteClosedException
    
    681 680
           -- real exception already reported once
    
    682 681
           failPendingWrites p $ toException PipeWriteClosedException
    
    683
    -    pipeCloseWrite p `catch` \(_ :: IOException) -> pure ()
    
    684 682
     
    
    685 683
     failPendingWrites :: Pipe -> SomeException -> STM ()
    
    686 684
     failPendingWrites p e = do