Created
June 21, 2014 18:24
-
-
Save cognominal/97929bf9f94d4b67e518 to your computer and use it in GitHub Desktop.
Eat a cpu to 97% on a macbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub MAIN($fnm) { | |
die unless $fnm.IO.r; | |
my $time = $fnm.IO.modified; | |
my $t = Supply.interval(1).tap(&compile-if-modified); | |
sleep 10000; | |
sub compile-if-modified($i) { | |
my $t1 = $fnm.IO.modified; | |
if $t1 > $time { | |
$time = $t1; | |
$t.close(); | |
say "compiling $fnm"; | |
run 'perl6', $fnm; | |
say "compiled"; | |
Supply.interval(1).tap(&compile-if-modified); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment