Skip to content

Commit

Permalink
Make sure we close filehandle after reading
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Aug 26, 2016
1 parent ebf34aa commit ede7c60
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/CompUnit/Repository/FileSystem.pm
Expand Up @@ -59,8 +59,13 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C
my $content-id = nqp::sha1(
[~]
map {
my $handle := $_.IO.open;
$handle ?? nqp::sha1($handle.slurp-rest(:enc<latin1>)) !! ''
if $_.IO.open -> $handle {
LEAVE $handle.close;
nqp::sha1($handle.slurp-rest(:enc<latin1>));
}
else {
''
}
},
grep {
try Rakudo::Internals.FILETEST-F($_)
Expand Down

0 comments on commit ede7c60

Please sign in to comment.