Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Clarify behaviour of unlink on non-existent files
Closes #2096 D#2096
  • Loading branch information
zoffixznet committed Jun 12, 2018
1 parent dc1ea46 commit 46d35a3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion doc/Type/IO/Path.pod6
Expand Up @@ -1011,7 +1011,20 @@ are privileges to do so. See L<rmdir> to delete directories.
The subroutine form returns the names of the files that were successfully
deleted. The method form returns C<True> on success, or L<fails|/routine/fail>
with L<X::IO::Unlink> if the operation could not be completed.
with L<X::IO::Unlink> if the operation could not be completed. If the file
to be deleted does not exist, the routine treats it as success.
=begin code
'foo.txt'.IO.open(:w).close;
'bar'.IO.mkdir;
say unlink <foo.txt bar not-there.txt>; # OUTPUT: «[foo.txt not-there.txt]␤»
# `bar` is not in output because it failed to delete (it's a directory)
# `not-there.txt` is present. It never existed, so that's deemed a success.
# Method form `fail`s:
say .exception.message without 'bar'.IO.unlink;
# OUTPUT: «Failed to remove the file […] illegal operation on a directory␤»
=end
=head2 method IO
Expand Down

0 comments on commit 46d35a3

Please sign in to comment.