use FindBin qw($Bin);
use lib "$Bin/lib";
-use Time::HiRes qw(sleep);
+use Time::HiRes qw(sleep time);
use Linux::Inotify2;
use POSIX qw(strftime WIFSIGNALED WTERMSIG SIGINT);
use Mojo::File;
-use Y::AoC qw(grey red);
+use Y::AoC qw(grey red white);
my $cmd = shift;
die "Usage: $0 ./command.pl" if !defined $cmd || !-x $cmd;
my $b = "$backup-".strftime("%H-%M-%S", localtime(time));
$file->copy_to($b);
$mtime = $file->stat->mtime;
+ my $starttime = time;
say grey("\nrunning $cmd @ARGV... ============================");
system $cmd, @ARGV;
if ($? && WIFSIGNALED($?) && WTERMSIG($?) == SIGINT) {
} else {
my $line;
$line .= (qw(. ' ~ - = _))[rand(5)] for 1 .. 30;
- say grey("finished OK $line");
+ say grey("finished OK $line after "),
+ white(sprintf('%.1f', time-$starttime), 's');
}
my $inotify = Linux::Inotify2->new;