Skip to content

Commit

Permalink
Add a temporal debugging code
Browse files Browse the repository at this point in the history
... 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
```
  • Loading branch information
mame committed Nov 22, 2024
1 parent 4e01878 commit 5bd144c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ext/io/console/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}

Expand Down

0 comments on commit 5bd144c

Please sign in to comment.