Add a temporal debugging code

... to check the return value of ioctl

http://ci.rvm.jp/results/trunk_asan@ruby-sp1/5423172
```
/tmp/ruby/src/trunk_asan/lib/reline/io/ansi.rb:192: [BUG] rb_sys_fail_str(<STDIN>) - errno == 0
```
This commit is contained in:
Yusuke Endoh 2024-11-22 14:29:47 +09:00
parent 4e01878bad
commit 5bd144c1bb
Notes: git 2024-11-22 06:00:42 +00:00

View File

@ -824,7 +824,14 @@ console_winsize(VALUE io)
{
rb_console_size_t ws;
int fd = GetWriteFD(io);
#if defined TIOCGWINSZ
// temporal debugging code
int ret = ioctl(fd, TIOCGWINSZ, &ws);
if (ret == -1) sys_fail(io);
if (ret != 0) rb_bug("ioctl(TIOCGWINSZ) returned %d", ret);
#else
if (!getwinsize(fd, &ws)) sys_fail(io);
#endif
return rb_assoc_new(INT2NUM(winsize_row(&ws)), INT2NUM(winsize_col(&ws)));
}