diff options
author | Peter Andersson <[email protected]> | 2012-08-23 17:23:08 +0200 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2012-08-23 17:23:08 +0200 |
commit | c9b4ce74e68d25b762a22facdbfe8ab1b078815a (patch) | |
tree | a551663d2db938586272f0dbf6d2a86bab7f6f56 /lib/common_test/src/ct_util.erl | |
parent | ada34eeaa3e7f034a3c69ccc95e1bcf2226cb7eb (diff) | |
download | otp-c9b4ce74e68d25b762a22facdbfe8ab1b078815a.tar.gz otp-c9b4ce74e68d25b762a22facdbfe8ab1b078815a.tar.bz2 otp-c9b4ce74e68d25b762a22facdbfe8ab1b078815a.zip |
Fix IO bug causing CT Hooks to hang at startup
Diffstat (limited to 'lib/common_test/src/ct_util.erl')
-rw-r--r-- | lib/common_test/src/ct_util.erl | 12 |
1 files changed, 8 insertions, 4 deletions
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]), |