@@ -343,8 +343,15 @@ call dict nid proc = do
343343 (\(ProcessMonitorNotification _ _ reason) -> return (Left reason))
344344 ]
345345 case mResult of
346− Right a -> unmonitor mRef >> return a
347− Left err -> fail $ "call: remote process died: " ++ show err
346+ Right a -> do
347+ -- Wait for the monitor message so that we the mailbox doesn't grow
348+ receiveWait
349+ [ matchIf (\(ProcessMonitorNotification ref _ _) -> ref == mRef)
350+ (\(ProcessMonitorNotification {}) -> return ())
351+ ]
352+ return a
353+ Left err ->
354+ fail $ "call: remote process died: " ++ show err
348355
349356-- | Spawn a child process, have the child link to the parent and the parent
350357-- monitor the child