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