Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env perl6
sub spinner() {
<\ - | - / ->[$++ % 6]
}
sub MAIN($expr, $filename) {
shell "tput 'civis'";
my $proc = Proc::Async.new:
<<tail -f $filename>>;
my $out = $proc.stdout;
start react {
whenever $out.lines.grep( / "$expr" / ) {
.say
}
whenever $out.lines {
print spinner() ~ "\r";
}
whenever signal(SIGINT) {
shell 'tput cnorm';
exit;
}
}
await $proc.start;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.