Skip to content

Conversation

@pjones
Copy link
Contributor

@pjones pjones commented Mar 24, 2022

When piping stdout to another process IRB fails:

lib/ruby/3.0.0/irb/input-method.rb:42:in `winsize': Inappropriate ioctl for device (Errno::ENOTTY)

For example:

echo n=1 | irb | cat

This bug was introduced in Ruby commits: e468d9f49ca34f713c030c623f655a40370e186d and triggered by 8f9b1902f48b413bd161666630c878ad58418c04 and 555ea8334451c5ccd881e68b8b7ddc15745e66e3.

See also: https://bugs.ruby-lang.org/issues/18657

When outputting a (possibly truncated) value, IRB will query the
window size.  However, if IRB was piped to another process, stdout
will no longer be a TTY and will not support the `winsize` method.

This fix ensure that stdout is a TTY.
@nobu nobu merged commit e93410e into ruby:master Jun 26, 2022
nobu added a commit to nobu/irb that referenced this pull request Jun 26, 2022
nobu added a commit to nobu/irb that referenced this pull request Jun 26, 2022
nobu added a commit to nobu/irb that referenced this pull request Jun 26, 2022
nobu added a commit that referenced this pull request Jun 26, 2022
matzbot pushed a commit to ruby/ruby that referenced this pull request Jun 26, 2022
@st0012 st0012 mentioned this pull request Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants