Skip to content

Instantly share code, notes, and snippets.

@colomon
Created August 29, 2017 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colomon/58dd2861239235027561a32c94a7a520 to your computer and use it in GitHub Desktop.
Save colomon/58dd2861239235027561a32c94a7a520 to your computer and use it in GitHub Desktop.
enum Results <success no-import hung crash>;
sub check-file($file) {
# say "working on $file";
my $proc = Proc::Async.new('utils/sat_nlib', $file);
$proc.stdout(:bin).tap: { Nil }
$proc.stderr(:bin).tap: { Nil }
my $promise;
await Promise.anyof($promise = $proc.start, Promise.at(now + 20));
if $promise.status != Kept {
$proc.kill;
return Results::hung;
}
return Results::crash if $promise.result.signal > 0;
return Results::no-import if $promise.result.exitcode > 0;
return Results::success;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment