#===== Open I/O pipes and run the process
$pid = open3(\*DEV_NULL, \*OUT, \*ERR, "my_long_process");
#===== Print the results
while (<OUT>)
{
$buffer .= $_;
#===== Update the display cache
$cache->set($session, [0, $buffer]);
}
Which works, except it waits until my_long_process completes before it sends any output back to the browser. If my_long_process takes an hour to run, the browser sits there for an hour with no updated information.
Is there a way to set open3() to an unbuffered mode so it returns what my_long_process is doing in real time?
Failing that, is there a better way to do this long process in the fork such that I can get its results as its doing things rather than waiting until the end?
Thanks!
CT
Charles Thomas
Madison, WI
|