Skip to content

Commit

Permalink
Explicitly close the output file
Browse files Browse the repository at this point in the history
Without this, windows complains about not having permission to write after processing some number of files.
  • Loading branch information
coke committed Jan 7, 2019
1 parent 5769c45 commit 0bfb92c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/Pod/Cache.pm6
Expand Up @@ -18,6 +18,7 @@ method cache-file(Str $file --> Str) {
$job.stdout.tap(-> $buf {$outfile.print: $buf});

await $job.start;
$outfile.close;
}
$outfile
}

1 comment on commit 0bfb92c

@b2gills
Copy link
Contributor

@b2gills b2gills commented on 0bfb92c Jan 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may be better as

my $outfile = $output-io.open(:w);
LEAVE $outfile.close;

or

my $outfile will leave {.close} = $output-io.open(:w);

If there is an error LEAVE will still run, but adding at the end of the scope won't.

Please sign in to comment.