Re: Capturing stdout without waiting for the process end

2006-04-03 Thread Donn Cave
In article <[EMAIL PROTECTED]>, "Luigi" <[EMAIL PROTECTED]> wrote: > The question is that I have a C program (by third part) that streams > the logs into the stderr and stdout devices. I need to create an > envelopment that captures the outputs and puts them in a file > generating log events (for

Re: Capturing stdout without waiting for the process end

2006-04-03 Thread [EMAIL PROTECTED]
Diez is correct, the C program is writting to stdout, you are reading from stdout. Default bahavior in most modern Unix like systems is to buffer std out. I stumbled on this a long time ago, so I am trying to remember the details. What I think is happening here, you call the child process, it do

Re: Capturing stdout without waiting for the process end

2006-04-03 Thread Diez B. Roggisch
> fin, fout = os.popen4(arg) > > this is executed asyncronously? And how can I intercept a fout.write() > event? You don't intercept anything, you read from the child process stdin, which from your POV is a readable stream. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Capturing stdout without waiting for the process end

2006-04-03 Thread Luigi
I use Linux. So, if I modify my sdtout behaviour, when I execute: fin, fout = os.popen4(arg) this is executed asyncronously? And how can I intercept a fout.write() event? The question is that I have a C program (by third part) that streams the logs into the stderr and stdout devices. I need to

Re: Capturing stdout without waiting for the process end

2006-04-03 Thread [EMAIL PROTECTED]
What OS are you doing this on? I had an issue similar to this and it was due to default buffering behavior of my tty's. If I recall correctly I executed a bunch of settty to eliminate the buffering behavior of stdout. The set the terminal back to it's original setting when my program was done.

Capturing stdout without waiting for the process end

2006-04-03 Thread Luigi
Hi to all! I'd like to execute an external program capturing the stdout/stderr messages at "real-time". I mean that I don't want to wait for the end of the process. If I write a code like this: import os import sys class Runner: def run(self, arg): try: fin, fout = os.po