Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Be sure to close before trying to unlink.
On Windows, this is required, otherwise the unlink fails.
  • Loading branch information
jnthn committed Sep 25, 2013
1 parent eee19ce commit c3da895
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion S16-filehandles/io.t
Expand Up @@ -239,6 +239,7 @@ nok $filename.IO ~~ :e, '... and the tempfile is gone, really';
my $buf = $binary_in_fh.read(4);
is $buf.elems, 3, "three bytes were read";
is $buf.decode("ISO-8859-1"), "föö", "the bytes decode into the right Str";
$binary_in_fh.close;
}

unlink($filename);
Expand All @@ -252,8 +253,10 @@ $out.close;
#?niecza todo 'Cannot open file straight from $filename.IO.get'
{
my $line;
lives_ok { $line = $filename.IO.get; }, "can read lines without explicitly opening IO";
my $io = $filename.IO;
lives_ok { $line = $io.get; }, "can read lines without explicitly opening IO";
is $line, 'Hello World', 'got the right line from .IO.get';
$io.close;
}
unlink($filename);

Expand Down

0 comments on commit c3da895

Please sign in to comment.