浏览器在完成该过程时清除输出,但我想保留它

function runupdate_output($text)
{
             $text = htmlspecialchars(str_replace("
", "\
", $text));
             print("
<script type=\"text/javascript\">");
             print("
//<![CDATA[");
             print("
this.document.forms[0].pfb_output.value = \"" . $text . "\";");
             print("
//]]>");
             print("
</script>");
             ob_flush();
}

From here I'm calling the above function The runout() is being called from somewhere else on the same page.

function runoutput($value)
{
    $cmd = "/root/dir/run_cmd.sh";
    $proc = popen($cmd, 'r');
    while (!feof($proc))
    {
       usleep(300000);
       $test = fread($proc, 4096);
       runupdate_output($test);
       flush();
    }
    fclose($proc);
}