Forum > General

Polling TProcess whilst running

<< < (2/2)

marcov:
instead of an external program, try to execute something liek the following program using the code


--- Code: ---begin
    for i:=0 to 49 do
       begin
          writeln('this is iteration ',i);
          flush(output);
          sleep(500);
       end;
end.

--- End code ---

and see if that works incremental.

TheFifth:
Yes that works, so it's definitely something specific to TZXTools by the look of it.  TZXTools is written in Python, so not sure if there's something odd about the way it handles piped output.

Thanks for all your input.  I can probably work around the issue by keeping track of the play time and comparing it against the start time of each block.  So it's not the end of the world.

Thanks again for all your help.

MarkMLl:

--- Quote from: TheFifth on May 08, 2021, 04:39:06 pm ---Yes that works, so it's definitely something specific to TZXTools by the look of it.  TZXTools is written in Python, so not sure if there's something odd about the way it handles piped output.

--- End quote ---

Check whether it's buffering stdout. I'm by no means a Python guru, but certainly when I was doing a lot of Perl there was a bit of mandatory magic to make sure that buffering was minimised...


--- Code: Perl  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  if (! $|) {    open(STDERR, '>&STDOUT') or         die "cannot redirect error messages to standard output - $!\n";    $| = 1;                             # Unbuffered output  }  print "Content-type: text/html\n\n"; 
Since Python has to such a large extent supplanted Perl, I'd be surprised if such a thing were not available. I'd also /not/ be surprised if somebody who didn't expect his program to be run inside a wrapper didn't know about it.

MarkMLl

TheFifth:

--- Quote from: MarkMLl on May 08, 2021, 07:50:41 pm ---Check whether it's buffering stdout. I'm by no means a Python guru, but certainly when I was doing a lot of Perl there was a bit of mandatory magic to make sure that buffering was minimised...

--- End quote ---

Thanks for the info, I'm also not that familiar with Python, so I'll see if I can get hold of the author and ask them.

Navigation

[0] Message Index

[*] Previous page

Go to full version