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