Hello
I have a (hopefully) small problem reading output from a command that throws off both STDOUT and STDERR. When run on the terminal, these two files are interspersed correctly.
The output takes the form of:
STDOUT blah blah blah
STDOUT processing file2
STDERR processing failed
STDOUT processing file3
STDOUT processing file4
etc etc
The problem is that when read, the output seems to be buffered, ie, STDOUT comes out together and STDERR comes out together - not interspesed. So, the error is meaningless unless I can see what the STDOUT line above is.
Is there a way to emulate an interactive terminal when running this command? That way, I'm hoping the output will be able to be processed in the same order as it appears on a terminal.
I've tried using 2>&1 inside `` and system() but to no avail.
Does anyone know how to get this to work?
Thanks
~ Michael
I have a (hopefully) small problem reading output from a command that throws off both STDOUT and STDERR. When run on the terminal, these two files are interspersed correctly.
The output takes the form of:
STDOUT blah blah blah
STDOUT processing file2
STDERR processing failed
STDOUT processing file3
STDOUT processing file4
etc etc
The problem is that when read, the output seems to be buffered, ie, STDOUT comes out together and STDERR comes out together - not interspesed. So, the error is meaningless unless I can see what the STDOUT line above is.
Is there a way to emulate an interactive terminal when running this command? That way, I'm hoping the output will be able to be processed in the same order as it appears on a terminal.
I've tried using 2>&1 inside `` and system() but to no avail.
Does anyone know how to get this to work?
Thanks
~ Michael