Hi! I have been using Capture::Tiny to read from processes I launch in my scripts. It works pretty good. Good module. The only thing I need more is reading processes STDOUT "in real time" which impossible with this module as it captures all the data till the process exits and then return it. It makes user waits till long running command finishes and don't let him to see it's STDOUT in real time.
Another solution with well known construction:
open(my $fh, '-|', $system_command) or die $!;
while (my $line = <$fh>) {
# Do stuff with each $line.
}
Does not work for me, as it for mysterious reasons _sometimes_ ( some rare cases of $system_command ) it waits forever even when $system_command finishes and return all the data as STDOUT.
Any suggestions?
PS both workaround for open(my $fh, '-|', $system_command) or suggestion new IPC related module would be fine.
In reply to Capture::Tiny alternative by melezhik
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |