summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2023-05-30 10:02:40 +0900
committerGitHub <noreply@github.com>2023-05-30 10:02:40 +0900
commit18e55fc1e1ec20e8f3166e3059e76c885fc9f8f2 (patch)
tree7e35773b3cd1ae50a0a94937df7fb175a3bed9ba /win32
parent7ddcd0622f3275effa603c16934b0215cc8a542b (diff)
Hide most of the implementation of `struct rb_io`. (#6511)
* Add rb_io_path and rb_io_open_descriptor. * Use rb_io_open_descriptor to create PTY objects * Rename FMODE_PREP -> FMODE_EXTERNAL and expose it FMODE_PREP I believe refers to the concept of a "pre-prepared" file, but FMODE_EXTERNAL is clearer about what the file descriptor represents and aligns with language in the IO::Buffer module. * Ensure that rb_io_open_descriptor closes the FD if it fails If FMODE_EXTERNAL is not set, then it's guaranteed that Ruby will be responsible for closing your file, eventually, if you pass it to rb_io_open_descriptor, even if it raises an exception. * Rename IS_EXTERNAL_FD -> RUBY_IO_EXTERNAL_P * Expose `rb_io_closed_p`. * Add `rb_io_mode` to get IO mode. --------- Co-authored-by: KJ Tsanaktsidis <ktsanaktsidis@zendesk.com>
Notes
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/win32/win32.c b/win32/win32.c
index ec65f5383b..c2d12a79f4 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -8269,10 +8269,7 @@ w32_io_info(VALUE *file, w32_io_info_t *st)
tmp = rb_check_convert_type_with_id(*file, T_FILE, "IO", idTo_io);
if (!NIL_P(tmp)) {
- rb_io_t *fptr;
-
- GetOpenFile(tmp, fptr);
- f = (HANDLE)rb_w32_get_osfhandle(fptr->fd);
+ f = (HANDLE)rb_w32_get_osfhandle(rb_io_descriptor(tmp));
if (f == (HANDLE)-1) return INVALID_HANDLE_VALUE;
}
else {