Skip to content

Commit 40966f2

Browse files
Recommend using RawFD instead of the Int returned by fd (#55027)
Helps with #51710 --------- Co-authored-by: Daniel Karrasch <[email protected]>
1 parent 23748ec commit 40966f2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

base/iostream.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ end
5151
5252
Return the file descriptor backing the stream or file. Note that this function only applies
5353
to synchronous `File`'s and `IOStream`'s not to any of the asynchronous streams.
54+
55+
File descriptors should typically be represented as [`RawFD`](@ref) objects, rather
56+
than as `Int`s, to ensure that they are properly interpreted by Julia functions.
57+
58+
Note that `RawFD` objects can be passed directly to other languages via the `ccall` interface.
5459
"""
5560
fd(s::IOStream) = Int(ccall(:jl_ios_fd, Clong, (Ptr{Cvoid},), s.ios))
5661

0 commit comments

Comments
 (0)