# File lib/mcollective/util.rb, line 405
    def self.terminal_dimensions(stdout = STDOUT, environment = ENV)
      return [0, 0] unless stdout.tty?

      return [80, 40] if Util.windows?

      if environment["COLUMNS"] && environment["LINES"]
        return [environment["COLUMNS"].to_i, environment["LINES"].to_i]

      elsif environment["TERM"] && command_in_path?("tput")
        return [`tput cols`.to_i, `tput lines`.to_i]

      elsif command_in_path?('stty')
        return `stty size`.scan(/\d+/).map {|s| s.to_i }
      else
        return [0, 0]
      end
    rescue
      [0, 0]
    end