G
g r a e m e b [at] c a d e n c e [dot] c o m
Hi,
I have a perl wrapper which runs a command (in this case, cvs) and formats the
output. It presently runs the command something like this:
$| = 1;
open(COMMAND, "$cmd 2>&1 |") || die "Couldn't run command";
while (<COMMAND>) {
print;
}
The problem is that the output from the command appears to arrive in chunks (a
bit like watching 'tail' on a file which is constantly updating). It looks as
though it's getting buffered until it exceeds a certain threshold, then all
coming out at once.
If I run it like this, however, the output comes out 'real time', as it does if
I run it on the command-line manually:
system("$cmd 2>&1");
Is there some way I can read from COMMAND and actually get the output when it
appears, rather than when there is a sizable chunk?
Thanks,
Graeme.
I have a perl wrapper which runs a command (in this case, cvs) and formats the
output. It presently runs the command something like this:
$| = 1;
open(COMMAND, "$cmd 2>&1 |") || die "Couldn't run command";
while (<COMMAND>) {
print;
}
The problem is that the output from the command appears to arrive in chunks (a
bit like watching 'tail' on a file which is constantly updating). It looks as
though it's getting buffered until it exceeds a certain threshold, then all
coming out at once.
If I run it like this, however, the output comes out 'real time', as it does if
I run it on the command-line manually:
system("$cmd 2>&1");
Is there some way I can read from COMMAND and actually get the output when it
appears, rather than when there is a sizable chunk?
Thanks,
Graeme.