<div>I am observing slow behavior for open_port() on Windows. The port program itself starts up quickly, but open_port() itself hangs for several seconds before returning... long after the port program is up and running.</div>
<div><br></div><div><br></div><div>Here is my instrumented Erlang code....</div><div><br></div><div><div> io:format("~p opening port~n",[now()]),</div><div> Port=open_port( {spawn_executable, Exe},</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> [</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> {cd, Dir},</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> {args, Args},</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> stream,</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> binary,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> exit_status</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> ]),</div>
<div> io:format("~p done port~n",[now()]),</div></div><div><br></div><div><br></div><div>My port program is a python PyQt program. One of the first things I have it do is...</div><div><br></div><div> logfile = open("c:\\logfile.txt","w")</div>
<div> print(time.time(), "starting", file=logfile)</div><div> </div><div><br></div><div><br></div><div>The output of my Erlang code interspersed with the above starting message is....</div><div><br></div><div><div>
{1320,789477,830000} opening port [werl.exe]</div><div> 1320789478.968 starting [my_port_program.exe]</div><div>{1320,789483,337000} done port [werl.exe]</div></div><div><br></div><div><br></div>
<div><br></div><div>Any idea why open_port() waits for so long before returning?</div><div><br></div><div><br></div><div>Thanks,</div><div>Dan.</div>