Skip to content

Commit 5bd144c

Browse files
committed
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 ```
1 parent 4e01878 commit 5bd144c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ext/io/console/console.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,14 @@ console_winsize(VALUE io)
824824
{
825825
rb_console_size_t ws;
826826
int fd = GetWriteFD(io);
827+
#if defined TIOCGWINSZ
828+
// temporal debugging code
829+
int ret = ioctl(fd, TIOCGWINSZ, &ws);
830+
if (ret == -1) sys_fail(io);
831+
if (ret != 0) rb_bug("ioctl(TIOCGWINSZ) returned %d", ret);
832+
#else
827833
if (!getwinsize(fd, &ws)) sys_fail(io);
834+
#endif
828835
return rb_assoc_new(INT2NUM(winsize_row(&ws)), INT2NUM(winsize_col(&ws)));
829836
}
830837

0 commit comments

Comments
 (0)