I still can't get the behavior I want where I print some text as soon as possible and then wait.

Here's the relevant parg of a  test .cgi:

$start=qx(date);

ui_print_unbuffered_header('
Changing communication mode');
$|=1;
print "started at $start\n<BR>";

my $type_ethernet=$in{'type_
ethernet'};

my $type_wifi=$in{'type_wifi'};

set_wifi($type_wifi);
set_ethernet($type_ethernet);

$end=qx(date);

print "ends at $end\n<BR>";

#print '<meta http-equiv="refresh" content="0;URL=index.cgi">';
footer();

The behavior of the "meta refresh" is what I want (at the end of the script, go to another page)

But everything seems to print at once:  (with and without the $|=1 trick)

Changing communication mode
started at Wed Jun 4 03:36:49 UTC 2014
ssh stop/waiting ssh start/running, process 20496 ends at Wed Jun 4 03:36:56 UTC 2014

(there should be about a 7 second visual delay between the started and ends, the data is transmitted instantenously).

I want the data to be transmitted when I write it.

I've done lots of playing with this simple example wihtout different results (seems the output is being buffered).

I have webmin being redirected through the SSL of nginx (though I can't imagine that would be a problem)

marty



On Fri, May 23, 2014 at 4:48 PM, Jamie Cameron <jcameron@webmin.com> wrote:

You can't use the redirect function, as that can only be called if header isn't. You should instead output some JS like :

<script>
window.location = "/module./page.cgi";
</script> 

On 23/May/2014 07:15 marty leisner <maleisner@gmail.com> wrote ..


Thanks -- its ui_print_unbuffered_header.

But after the page is displayed, I want to force a redirect to another page -- how would I do it

Something like:
&ui_print_unbuffered_header('please wait');
system('date');
print "<BR>\n";
sleep(5);
system('date');
print "<BR>first line\n<BR>";
sleep(5);
system('date');
print "<BR>second line\n<BR>";

footer();

# redirect('index.cgi');

marty


On Wed, May 21, 2014 at 1:47 PM, Jamie Cameron <jcameron@webmin.com> wrote:

Try using un_print_unbuffered_header instead of ui_print_header 

On 20/May/2014 21:20 marty leisner <maleisner@gmail.com> wrote ..

I'm having a problem where my page is delivered on the network at the same time -- after the delay (I used wireshark to
monitor this)

What I want tried is:

ui_print_header('please wait');
footer();
sleep(5);
print "final\n<BR>";

I would have expected to see the header render, a delay, and "final".

Its all happening after the delay.

What I really want to do is:

display "please wait"
run a long command
redirect to another page (after the command runs)

marty


On Tue, May 20, 2014 at 4:19 PM, Jamie Cameron <jcameron@webmin.com> wrote:
On 20/May/2014 09:27 marty leisner <maleisner@gmail.com> wrote ..
> When having a custom module in webmin execute time consuming commands, how
> would I add a
> "please wait" message until the command is finished (without user
> interaction).
>
> I.e.:
>
> start_please_wait();
> system("long_command");
> stop_please_wait();

In some modules, I've had Webmin print out a series of dots (one per second)
while performing some long operation. The code is like :

print "Doing something slow ..";
launch_slow_op_in_background();
while(!done_slow_op()) {
  sleep(1);
  print ".";
  }
print "<br>\n";
print ".. done<p>\n";

 - Jamie

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
-
Forwarded by the Webmin development list at webmin-devel@webmin.com
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel



------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
-
Forwarded by the Webmin development list at webmin-devel@webmin.com
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel




------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
-
Forwarded by the Webmin development list at webmin-devel@webmin.com
To remove yourself from this list, go to
http://lists.sourceforge.net/lists/listinfo/webadmin-devel