Project

General

Profile

Actions

Bug #10986

closed

fancy_irb broken

Bug #10986: fancy_irb broken

Added by fritz.heinrichmeyer@gmail.com (Friedrich Heinrichmeyer) over 10 years ago. Updated over 10 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
[ruby-core:<unknown>]

Description

 ruby -v
ruby 2.0.0p481 (2014-05-08) [i386-mingw32]
c:\Ruby200-x64\bin>irb
DL is deprecated, please use Fiddle
c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/fancy_irb-0.8.0/lib/fancy_irb/terminal_i
nfo.rb:10:in `winsize': Bad file descriptor (Errno::EBADF)
        from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/fancy_irb-0.8.0/lib/fancy_i
rb/terminal_info.rb:10:in `cols'
        from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/fancy_irb-0.8.0/lib/fancy_i
rb/implementation.rb:84:in `track_height'
        from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/fancy_irb-0.8.0/lib/fancy_i
rb/implementation.rb:148:in `block in patch_stream'
        from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/fancy_irb-0.8.0/lib/fancy_i
rb/clean_up.rb:1:in `print'
        from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/fancy_irb-0.8.0/lib/fancy_i
rb/clean_up.rb:1:in `block in <top (required)>'
c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/fancy_irb-0.8.0/lib/fancy_irb/terminal_i
nfo.rb:10:in `winsize': Bad file descriptor (Errno::EBADF)
        from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/fancy_irb-0.8.0/lib/fancy_i
rb/terminal_info.rb:10:in `cols'
        from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/fancy_irb-0.8.0/lib/fancy_i
rb/implementation.rb:84:in `track_height'
        from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/fancy_irb-0.8.0/lib/fancy_i
rb/implementation.rb:148:in `block in patch_stream'
        from c:/Ruby200-x64/lib/ruby/2.0.0/irb/init.rb:239:in `print'
        from c:/Ruby200-x64/lib/ruby/2.0.0/irb/init.rb:239:in `rescue in run_con
fig'
        from c:/Ruby200-x64/lib/ruby/2.0.0/irb/init.rb:235:in `run_config'
        from c:/Ruby200-x64/lib/ruby/2.0.0/irb/init.rb:19:in `setup'
        from c:/Ruby200-x64/lib/ruby/2.0.0/irb.rb:380:in `start'
        from irb:12:in `<main>'
gem list io-console

*** LOCAL GEMS ***

io-console (0.4.2)

C:\Users\Fritz Heinrichmeyer>ruby -r io/console -e 'p STDIN.winsize'
-e:1:in `winsize': Bad file descriptor (Errno::EBADF)
        from -e:1:in `<main>'

irb(main):001:0> require 'io/console/size'
=> true
irb(main):002:0> [ENV["LINES"], ENV["COLUMNS"]]
=> ["300", "80"]
irb(main):003:0> IO.console_size
=> [25, 80]

irb(main):007:0> [`tput lines`, `tput cols`]
Errno::ENOENT: No such file or directory - tput lines
        from (irb):7:in ``'
        from (irb):7
        from irb:12:in `<main>'
irb(main):008:0> require "English"
=> true
irb(main):009:0> $LOAD_PATH
=> ["c:/Ruby200-x64/lib/ruby/site_ruby/2.0.0", "c:/Ruby200-x64/lib/ruby/site_rub
y/2.0.0/x64-msvcrt", "c:/Ruby200-x64/lib/ruby/site_ruby", "c:/Ruby200-x64/lib/ru
by/vendor_ruby/2.0.0", "c:/Ruby200-x64/lib/ruby/vendor_ruby/2.0.0/x64-msvcrt", "
c:/Ruby200-x64/lib/ruby/vendor_ruby", "c:/Ruby200-x64/lib/ruby/2.0.0", "c:/Ruby2
00-x64/lib/ruby/2.0.0/x64-mingw32"]
irb(main):010:0> $DEFAULT_OUTPUT
=> #<IO:<STDOUT>>

Mit freundlichen Grüßen, Fritz Heinrichmeyer


Files

irb-bat.png (19.3 KB) irb-bat.png screen photo fritz.heinrichmeyer@gmail.com (Friedrich Heinrichmeyer), 03/23/2015 10:13 AM

Updated by usa (Usaku NAKAMURA) over 10 years ago Actions #1

  • Status changed from Open to Third Party's Issue

Tell the author of fancy_irb to use STDOUT.winsize instead of STDIN.winsize.

Updated by fritz.heinrichmeyer@gmail.com (Friedrich Heinrichmeyer) over 10 years ago Actions #2

I have two Boxes(i586 und x64) with equal error in "erb" respectively "fancy_irb"
c:\Ruby200-x64\bin>ruby -v
ruby 2.0.0p481 (2014-05-08) [x64-mingw32]

Updated by rbjl (Jan Lelis) over 10 years ago Actions #3

Thanks for the hint. This should be patched in the docs:

diff --git a/io.c b/io.c
index 3a0cc01..7978c77 100644
--- a/io.c
+++ b/io.c
@@ -12098,7 +12098,7 @@ rb_readwrite_sys_fail(int writable, const char *mesg)
  *  Example:
  *
  *    require 'io/console'
- *    rows, columns = $stdin.winsize
+ *    rows, columns = $stdout.winsize
  *    puts "Your screen is #{columns} wide and #{rows} tall"
  */

Updated by usa (Usaku NAKAMURA) over 10 years ago Actions #4

  • Status changed from Third Party's Issue to Assigned
  • Assignee set to nobu (Nobuyoshi Nakada)

Updated by nobu (Nobuyoshi Nakada) over 10 years ago Actions #5

  • Description updated (diff)

https://msdn.microsoft.com/ja-jp/library/windows/desktop/ms683171%28v=vs.85%29.aspx states:

hConsoleOutput [in]

A handle to the console screen buffer. The handle must have the GENERIC_READ access right. For more information, see Console Buffer Security and Access Rights.

Is this incorrect?

Updated by nobu (Nobuyoshi Nakada) over 10 years ago Actions #6

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Applied in changeset r50041.


console.c: winsize on Windows

  • ext/io/console/console.c (console_set_winsize): use handle for
    writing. GetConsoleScreenBufferInfo seems failing on a handle
    for reading.
  • io.c: [DOC] update the example of IO#winsize to use $stdout
    instead of $stdin, which does not work on Windows. a patch by
    Jan Lelis at [ruby-core:68574].
    [Bug #10986]

Updated by fritz.heinrichmeyer@gmail.com (Friedrich Heinrichmeyer) over 10 years ago Actions #7

fancy_irb-0.8.1(Ruby 2.0.0p481 (2014-05-08) [x64-mingw32])
I can’t not the old input line error free edited. See screen photo (attachment).

fancy_irb-0.7.3(IRB: You are using ruby 1.9.3p374 (2013-01-15)) was error free.

Mit freundlichen Grüßen, Fritz Heinrichmeyer

Updated by usa (Usaku NAKAMURA) over 10 years ago Actions #8

Ah, here is hte bug tracker for ruby itself, not for third party's gems.
Try to report at https://github.com/janlelis/fancy_irb .

Jan, please take this issue in your project.
If you find that this is a bug of ruby, let me know again.

Actions

Also available in: PDF Atom