Skip to content

Commit decc029

Browse files
nobumatzbot
authored andcommitted
[ruby/io-console] Check if rb_syserr_fail_str is available
Truffle ruby seems to lack it. ruby/io-console@839c1e80eb
1 parent 9b60366 commit decc029

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

ext/io/console/console.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ io_get_write_io_fallback(VALUE io)
125125
#define rb_io_get_write_io io_get_write_io_fallback
126126
#endif
127127

128+
#ifndef DHAVE_RB_SYSERR_FAIL_STR
129+
# define rb_syserr_fail_str(e, mesg) rb_exc_raise(rb_syserr_new_str(e, mesg))
130+
#endif
131+
128132
#define sys_fail(io) do { \
129133
int err = errno; \
130134
rb_syserr_fail_str(err, rb_io_path(io)); \

ext/io/console/extconf.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
# See https://bugs.ruby-lang.org/issues/20345
66
MakeMakefile::RbConfig ||= ::RbConfig
77

8+
have_func("rb_syserr_fail_str(0, Qnil)") or
9+
have_func("rb_syserr_new_str(0, Qnil)") or
10+
abort
11+
812
have_func("rb_io_path")
913
have_func("rb_io_descriptor")
1014
have_func("rb_io_get_write_io")

0 commit comments

Comments
 (0)