in reply to Executing a shell script with progress indicator
This is easy using threads::async
#! perl -slw use strict; use threads qw[ async ]; use threads::shared; $|=1; my $done:shared = 0; my $rc :shared = 0; async { system @ARGV; $rc = $? >> 8; $done = 1; }; my $n=0; printf "%s\b", substr '|/-\ ', ($n = ++$n % 4), 1 while select( '','','',0.25) and not $done; print "@ARGV : rc = $rc"; __END__ P:\test>499224 perl -e"sleep 10; exit 123" perl -esleep 10; exit 123 : rc = 123
|
---|