From c9b4ce74e68d25b762a22facdbfe8ab1b078815a Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Thu, 23 Aug 2012 17:23:08 +0200 Subject: Fix IO bug causing CT Hooks to hang at startup --- lib/common_test/src/ct_util.erl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/common_test/src/ct_util.erl') diff --git a/lib/common_test/src/ct_util.erl b/lib/common_test/src/ct_util.erl index 95072ebf58..efc85543ac 100644 --- a/lib/common_test/src/ct_util.erl +++ b/lib/common_test/src/ct_util.erl @@ -858,13 +858,17 @@ call(Msg) -> call(Msg, infinity). call(Msg, Timeout) -> - case whereis(ct_util_server) of - undefined -> + case {self(),whereis(ct_util_server)} of + {_,undefined} -> {error,ct_util_server_not_running}; - Pid -> + {Pid,Pid} -> + %% the caller is ct_util_server, which must + %% be a mistake + {error,bad_invocation}; + {Self,Pid} -> MRef = erlang:monitor(process, Pid), Ref = make_ref(), - ct_util_server ! {Msg,{self(),Ref}}, + ct_util_server ! {Msg,{Self,Ref}}, receive {Ref, Result} -> erlang:demonitor(MRef, [flush]), -- cgit v1.2.3