From: ronald braswell Date: 2007-08-08T03:44:43+09:00 Subject: Re: Need Solaris Help ------=_Part_48602_33428247.1186512287766 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 8/7/07, Gregory Brown wrote: > > On 8/7/07, James Edward Gray II wrote: > > I'm told the following bit of code doesn't work on Solaris: > > > > # A Unix savvy method to fetch the console columns, and rows. > > def terminal_size > > `stty size`.split.map { |x| x.to_i }.reverse > > end > > > > HighLine makes use of this method as does Capistrano by extension, so > > we need find a portable solution. > > Ruport vendors this chunk of code, so sorry for the 'me too', but me too! > > This is not pretty but it works on my Solaris 10 x64 box. But you may have been looking for something more elegant. if `stty` =~ /.*\brows = (\d+).*\bcolumns = (\d+)/ rows = $1 columns = $2 end Ron ------=_Part_48602_33428247.1186512287766--