in reply to How to cpture output of interactive command using perl.?
use File::Temp qw(tempfile); my ($fh, $filename) = tempfile(); close $fh; system("your_command | tee $filename"); # then open $filename for reading, it contains the output
But since now the STDOUT of your program is connected to a pipe, it might do a bit more buffering, which is bad for the user experience on the interactive program.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to cpture output of interactive command using perl.?
by xdg (Monsignor) on Dec 10, 2008 at 15:16 UTC | |
|
Re^2: How to cpture output of interactive command using perl.?
by pobocks (Chaplain) on Dec 10, 2008 at 14:14 UTC |