Skip to content

Commit

Permalink
Fix stty error message
Browse files Browse the repository at this point in the history
When stdin is redirected in, it is able to default to 80 columns
but it is displaying a warning in the console

See PR comments for more info

Fixes #25
  • Loading branch information
kbrock committed Jun 25, 2020
1 parent d66ee2e commit db11063
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ruport.rb
Expand Up @@ -67,11 +67,11 @@ def terminal_size
# A Unix savvy method to fetch the console columns, and rows.
def terminal_size
size = if /solaris/ =~ RUBY_PLATFORM
output = `stty`
output = `stty 2>&1`
[output.match('columns = (\d+)')[1].to_i,
output.match('rows = (\d+)')[1].to_i]
else
`stty size`.split.map { |x| x.to_i }.reverse
`stty size 2>&1`.split.map { |x| x.to_i }.reverse
end
return $? == 0 ? size : [80,24]
end
Expand Down

0 comments on commit db11063

Please sign in to comment.