ANSI::Terminal fails to detect Windows #12

Open
eric-smartlove opened this Issue Jul 30, 2012 · 7 comments

Comments

Projects
None yet
5 participants
@eric-smartlove

I am on Windows XP.

When I type:

require "ansi"
ANSI::Terminal.terminal_width

I have the message: No such file or directory - stty size

In https://github.com/rubyworks/ansi/blob/master/lib/ansi/terminal.rb, the code seems to require successively ansi/terminal/stty, ansi/terminal/curses, ansi/terminal/termios and ansi/terminal/win32 until one of these require does not raises.

I guess that stty is supposed to raise on Windows, to avoid using this library. However when I require manually ansi/terminal/stty, it does not raises.

In fact, when I read the code of ansi/terminal/stty I do not see anything that can raise on Windows (or on any platform).

@eric-smartlove eric-smartlove referenced this issue in busyloop/powerbar Jul 30, 2012

Closed

No such file or directory - stty size #5

@m-o-e

This comment has been minimized.

Show comment
Hide comment
@m-o-e

m-o-e Oct 11, 2012

Bump!

No love for windows, anyone?

m-o-e commented Oct 11, 2012

Bump!

No love for windows, anyone?

@natebeck

This comment has been minimized.

Show comment
Hide comment
@natebeck

natebeck Dec 18, 2012

I have run into this issue on Windows as well, might take a stab at fixing it.

I have run into this issue on Windows as well, might take a stab at fixing it.

@muellerj

This comment has been minimized.

Show comment
Hide comment

muellerj commented Jan 9, 2013

+1

@trans

This comment has been minimized.

Show comment
Hide comment
@trans

trans Jan 6, 2015

Member

I would love to merge a fix. I do not use Windows (for development) so it would be better for someone who does to take a stab at it.

Member

trans commented Jan 6, 2015

I would love to merge a fix. I do not use Windows (for development) so it would be better for someone who does to take a stab at it.

@trans

This comment has been minimized.

Show comment
Hide comment
@trans

trans Jan 7, 2015

Member

I may have fixed it. All this time and I think the simple error was pop should have been shift, i.e. the platforms files were being required in the wrong order.

Member

trans commented Jan 7, 2015

I may have fixed it. All this time and I think the simple error was pop should have been shift, i.e. the platforms files were being required in the wrong order.

@muellerj

This comment has been minimized.

Show comment
Hide comment
@muellerj

muellerj Jan 8, 2015

require "ansi"
ANSI::Terminal.terminal_width # => 207

now works for me on Win7 under Cygwin. Is that a conclusive test?

muellerj commented Jan 8, 2015

require "ansi"
ANSI::Terminal.terminal_width # => 207

now works for me on Win7 under Cygwin. Is that a conclusive test?

@trans

This comment has been minimized.

Show comment
Hide comment
@trans

trans Jan 9, 2015

Member

Pretty much. And if that works for straight Windows (no Cygwin) then I think this issue if finally close able. Yay! (Though I am sure improvements are to be had, e.g. I've seen code in the wild that indicate to me that JRuby support might need some love.)

Member

trans commented Jan 9, 2015

Pretty much. And if that works for straight Windows (no Cygwin) then I think this issue if finally close able. Yay! (Though I am sure improvements are to be had, e.g. I've seen code in the wild that indicate to me that JRuby support might need some love.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment