Skip to content

Commit b09385a

Browse files
authored
Document .DESTROY doesn't close standard handles
1 parent 188d98e commit b09385a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

doc/Type/IO/Handle.pod6

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,10 @@ Defined as:
182182
183183
submethod DESTROY(IO::Handle:D:)
184184
185-
Closes the filehandle. Note that garbage collection is not guaranteed to
185+
Closes the filehandle, unless its L<native-descriptor> is C<2> or lower. This
186+
ensures the standard file handles do not get inadvertently closed.
187+
188+
Note that garbage collection is not guaranteed to
186189
happen, so you must NOT rely on C<DESTROY> for closing the handles you
187190
I<write to> and instead close them yourself. Programs that open a lot of files
188191
should close the handles explicitly as well, regardless of whether they were

0 commit comments

Comments
 (0)