diff --git a/src/extauth.erl b/src/extauth.erl index c1721a0ef..3b2e7db64 100644 --- a/src/extauth.erl +++ b/src/extauth.erl @@ -126,7 +126,8 @@ loop(Port, Timeout, ProcessName, ExtPrg) -> ?ERROR_MSG("extauth call '~p' didn't receive response", [Msg]), Caller ! {eauth, false}, unregister(ProcessName), - spawn(?MODULE, init, [ProcessName, ExtPrg]), + Pid = spawn(?MODULE, init, [ProcessName, ExtPrg]), + flush_buffer_and_forward_messages(Pid), exit(port_terminated) end; stop -> @@ -140,6 +141,15 @@ loop(Port, Timeout, ProcessName, ExtPrg) -> exit(port_terminated) end. +flush_buffer_and_forward_messages(Pid) -> + receive + Message -> + Pid ! Message, + flush_buffer_and_forward_messages(Pid) + after 0 -> + true + end. + join(List, Sep) -> lists:foldl(fun(A, "") -> A; (A, Acc) -> Acc ++ Sep ++ A