N
Neil Palmer
I'm working on a script that makes a call to an external program that
produces a bunch of postscript and PDF files. The external program
normally issues a bunch of informational messages to STDOUT, and I
want to capture them and display them from the script. That should be
easily enough done:
#!c:/perl/bin/perl.exe -w
$| = 1;
my $execute = 'C:/Progra~1/Appdir/app.exe';
my $param1 = '-ID=customerID';
my $param2 = '-format=formattingcodes';
my $command = "$execute $param1 $param2";
open (PIPE, "$command |") || die "Cannot pipe command\n";
while (my $line = <PIPE>) {
print "$line\n";
}
close(PIPE);
#process newly created PS and PDF here
However, depending on what exactly we're producing from a given run,
the external command can take up to an hour to run. And from what
I've seen, the output doesn't get sent to the screen until the command
has finished running.
What I want to do is have any output that the external app might
produce be displayed as it is produced, rather than be held until
everything is finished, to serve as a visual feedback that the script
is in fact running as it should. I don't care about STDERR, only
STDOUT.
Any suggestions? Any other information I can provide?
ActiveState perl v5.6.1, build 631, running under Win2K
produces a bunch of postscript and PDF files. The external program
normally issues a bunch of informational messages to STDOUT, and I
want to capture them and display them from the script. That should be
easily enough done:
#!c:/perl/bin/perl.exe -w
$| = 1;
my $execute = 'C:/Progra~1/Appdir/app.exe';
my $param1 = '-ID=customerID';
my $param2 = '-format=formattingcodes';
my $command = "$execute $param1 $param2";
open (PIPE, "$command |") || die "Cannot pipe command\n";
while (my $line = <PIPE>) {
print "$line\n";
}
close(PIPE);
#process newly created PS and PDF here
However, depending on what exactly we're producing from a given run,
the external command can take up to an hour to run. And from what
I've seen, the output doesn't get sent to the screen until the command
has finished running.
What I want to do is have any output that the external app might
produce be displayed as it is produced, rather than be held until
everything is finished, to serve as a visual feedback that the script
is in fact running as it should. I don't care about STDERR, only
STDOUT.
Any suggestions? Any other information I can provide?
ActiveState perl v5.6.1, build 631, running under Win2K