Sha256: 47c67164453444e118a82ff25be1890baddbae09a210ea22f247c26ad45f0209
Contents?: true
Size: 888 Bytes
Versions: 7
Compression:
Stored size: 888 Bytes
Contents
# -*- coding: binary -*- require 'rex/ui' begin require 'windows_console_color_support' rescue ::LoadError end module Rex module Ui module Text ### # # This class implements output against standard out. # ### class Output::Stdio < Rex::Ui::Text::Output def supports_color? case config[:color] when true return true when false return false else # auto if (Rex::Compat.is_windows) return true end term = Rex::Compat.getenv('TERM') return (term and term.match(/(?:vt10[03]|xterm(?:-color)?|linux|screen|rxvt)/i) != nil) end end # # Prints the supplied message to standard output. # def print_raw(msg = '') if (Rex::Compat.is_windows and supports_color?) WindowsConsoleColorSupport.new($stdout).write(msg) else $stdout.print(msg) end $stdout.flush msg end end end end end
Version data entries
7 entries across 7 versions & 3 rubygems