# File lib/bee_util.rb, line 36
    def self.term_width
      begin
        tiocgwinsz = RUBY_PLATFORM =~ /darwin/ ? 0x40087468 : 0x5413
        string = [0, 0, 0, 0].pack('SSSS')
        if $stdin.ioctl(tiocgwinsz, string) >= 0 then
          rows, cols, xpixels, ypixels = string.unpack('SSSS')
          cols = DEFAULT_TERM_WIDTH if cols <= 0
          return cols
        else
          return DEFAULT_TERM_WIDTH
        end
      rescue
        return DEFAULT_TERM_WIDTH
      end
    end