ruby-progressbar could use ioctl support on output devices
----------------------------------------------------------
Key: JRUBY-4493
URL: http://jira.codehaus.org/browse/JRUBY-4493
Project: JRuby
Issue Type: Improvement
Components: Extensions
Affects Versions: JRuby 1.4
Environment: Gentoo Linux, JRuby 1.4.0
Reporter: Diego Elio Pettenò
Priority: Trivial
def get_width
# FIXME: I don't know how portable it is.
default_width = 80
begin
tiocgwinsz = 0x5413
data = [0, 0, 0, 0].pack("SSSS")
if @out.ioctl(tiocgwinsz, data) >= 0 then
rows, cols, xpixels, ypixels = data.unpack("SSSS")
if cols >= 0 then cols else default_width end
else
default_width
end
rescue Exception
default_width
end
end
This code is part of ruby-postgres (http://github.com/nex3/ruby-progressbar)...
while not strictly needed, I guess it's good to know that it would be used if
present ;)
HTH!
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email