<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi,<br>
<br>
I would go to the javascript wrapper solution :<br>
I would wrap cgi-script to send javascript code to browser and then
redirect original script output to the html file<br>
In a javascript I would loop (and sleep) until load of html file
will succeed.<br>
<br>
<br>
<br>
<br>
On 12/27/2010 08:26 PM, Dov Grobgeld wrote:
<blockquote
cite="mid:AANLkTin6d4BQxh8mOqVZ4n_qn6v9MQSn_ZWU7OrWT_5r@mail.gmail.com"
type="cite">
<meta http-equiv="Context-Type" content="text/html;
charset=ISO-8859-1">
<div>Thanks for the help! Based on it I tried running the command
with python as follows:<br>
<br>
<div>import subprocess<br>
<br>
pipe = subprocess.Popen("do_slow_command 2>&1",<br>
bufsize=1,<br>
stdout=subprocess.PIPE,<br>
stdin=subprocess.PIPE,<br>
shell=True)<br>
<br>
for p in pipe.stdout.readlines():<br>
print p,"<br>\n"<br>
<br>
</div>
According to the subprocess documentation, this is supposed to
set up line by line mode. But I still get things buffered up.
But perhaps that is because I did not tell "do_slow_command" to
flush after print command, and it senses that it is not being
run under a terminal? I'll try that.<br>
<br>
Dov<br>
<br>
<br>
<div>On Mon, Dec 27, 2010 at 20:08, ik <span><<a
moz-do-not-send="true" href="mailto:idokan@gmail.com">idokan@gmail.com</a>></span>
wrote:<br>
<blockquote>
<div>
<div>2010/12/27 shimi <span><<a moz-do-not-send="true"
href="mailto:linux-il@shimi.net">linux-il@shimi.net</a>></span>
<div>
<div><br>
<blockquote>
<div><br>
<br>
<div>
<div>2010/12/27 Dov Grobgeld <span><<a
moz-do-not-send="true"
href="mailto:dov.grobgeld@gmail.com">dov.grobgeld@gmail.com</a>></span><br>
</div>
<blockquote>
<div>I'm trying to write a cgi wrapper for a
long running command. The command takes
about 10minutes to execute and when
running it from the command line it
continously outputs text to stdout. A
simplistic cgi-bin wrapper that tries to
execute the script and then writes that it
is done fails with the following message:
<div>
<div><br>
<br>
Timeout waiting for output from CGI
script ...<br>
<br>
What I wonder if there is any easy way
to have continously update the web
page with stdout of the script. <br>
<br>
One way, I guess would be to run the
script in a separate thread and just
do HTML reload on a static page which
I would regenaret with the stdout
generated so far.<br>
<br>
Is there any other simple solution?<br>
<br>
</div>
</div>
</div>
</blockquote>
<div><br>
You could increase the timeout to be >
running time of the script ...<br>
</div>
</div>
</div>
</blockquote>
</div>
</div>
<div><br>
Do not forget that you also have timeout of the web
browser that you can not control (you can not control
the users themselves). <br>
</div>
<blockquote>
<div>
<div>
<div><br>
-- Shimi<br>
</div>
</div>
</div>
</blockquote>
<div><br>
Ido<br>
<br>
</div>
<div>
<blockquote>
<div>
<div>
</div>
<br>
</div>
<br>
_______________________________________________<br>
Linux-il mailing list<br>
<a moz-do-not-send="true"
href="mailto:Linux-il@cs.huji.ac.il">Linux-il@cs.huji.ac.il</a><br>
<a moz-do-not-send="true"
href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il">http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il</a><br>
<br>
</blockquote>
</div>
</div>
<br>
<div><br>
LINESIP - Opening the source for communication<br>
<a moz-do-not-send="true" href="http://www.linesip.com/">http://www.linesip.com</a><br>
<a moz-do-not-send="true"
href="http://www.linesip.co.il/">http://www.linesip.co.il</a><br>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Linux-il mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Linux-il@cs.huji.ac.il">Linux-il@cs.huji.ac.il</a>
<a class="moz-txt-link-freetext" href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il">http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il</a>
</pre>
</blockquote>
<br>
</body>
</html>