8000 Some operations throwing the exception reline/ansi.rb:246:in `winsize': Operation not supported by device - <STDIN> (Errno::ENODEV) · Issue #690 · ruby/reline · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Some operations throwing the exception reline/ansi.rb:246:in `winsize': Operation not supported by device - <STDIN> (Errno::ENODEV)  #690
Closed
@vtamara

Description

@vtamara

Description

On OpenBSD/adJ 7.4 on a tmux session the exception Errno::ENODEV is thrown in the following scenario:

  1. In a rails project create a file q.sh to run the application in development mode but in the background i.e:
    #!/bin/sh
    bin/rails s &
  2. Execute the script
    % chmod +x ./q.sh
    % ./q.sh
    /var/www/bundler/ruby/3.3/gems/reline-0.5.3/lib/reline/ansi.rb:246:in `winsize': Operation not supported by device - <STDIN> (Errno::ENODEV)                    
        from /var/www/bundler/ruby/3.3/gems/reline-0.5.3/lib/reline/ansi.rb:246:in `get_screen_size'
        from /var/www/bundler/ruby/3.3/gems/reline-0.5.3/lib/reline/line_editor.rb:78:in `initialize'                              
        from /var/www/bundler/ruby/3.3/gems/reline-0.5.3/lib/reline.rb:542:in `new'  
        from /var/www/bundler/ruby/3.3/gems/reline-0.5.3/lib/reline.rb:542:in `block in core'                                                                   
        from /var/www/bundler/ruby/3.3/gems/reline-0.5.3/lib/reline.rb:80:in `initialize'   

Checking the source code of reline 0.5.3 in lib/reline/ansi.rb function get_screen_size I notice that you handle only the exception Errno::ENOTTY:

  def self.get_screen_size                                                                                                                                      
    s = @@input.winsize                                                                                                                                         
    return s if s[0] > 0 && s[1] > 0                                                                                                                            
    s = [ENV["LINES"].to_i, ENV["COLUMNS"].to_i]                                                                                                                
    return s if s[0] > 0 && s[1] > 0                                                                                                                            
    [24, 80]                                                                                                                                                    
  rescue Errno::ENOTTY                                                                                                                                          
    [24, 80]                                                                                                                                                    
  end    

IMHO it is the same problem described by @revolter and @forthrin in #537.

It has worked for me to add support for the Errno::ENODEV exception i.e changing

  rescue Errno::ENOTTY

for

  rescue Errno::ENOTTY, Errno::ENODEV

Terminal Emulator

tmux on xterm on OpenBSD/adJ 7.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0