Restore MinGW code and use =begin/=end for indent

bug/bundler_fix
William Vu 2016-12-21 00:38:08 -06:00
parent d0d84b418b
commit 4098c66efb
2 changed files with 20 additions and 12 deletions

View File

@ -140,14 +140,18 @@ begin
# []`Readline.readline`](https://github.com/luislavena/rb-readline/blob/ce4908dae45dbcae90a6e42e3710b8c3a1f2cd64/lib/readline.rb#L36-L58)
# for rb-readline to support setting input and output. Output needs to
# be set so that colorization works for the prompt on Windows.
#
self.prompt = prompt
# TODO: there are unhandled quirks in async output buffering that
# we have not solved yet, for instance when loading meterpreter
# extensions, supporting Windows, printing output from commands, etc.
# Remove this guard when issues are resolved.
# reset_sequence = "\n\001\r\033[K\002"
=begin
reset_sequence = "\n\001\r\033[K\002"
if (/mingw/ =~ RUBY_PLATFORM)
reset_sequence = ""
end
=end
reset_sequence = ""
if defined? RbReadline

View File

@ -58,20 +58,24 @@ class Output::Stdio < Rex::Ui::Text::Output
# Use ANSI Control chars to reset prompt position for async output
# SEE https://github.com/rapid7/metasploit-framework/pull/7570
def print_line(msg = '')
# TODO: there are unhandled quirks in async output buffering that
# we have not solved yet, for instance when loading meterpreter
# extensions, supporting Windows, printing output from commands, etc.
# Remove this guard when issues are resolved.
#
# print("\033[s") # Save cursor position
# print("\r\033[K" + msg + "\n")
# if input and input.prompt
# print("\r\033[K")
# print(input.prompt.tr("\001\002", ''))
# print(input.line_buffer.tr("\001\002", ''))
# print("\033[u\033[B") # Restore cursor, move down one line
# end
=begin
if (/mingw/ =~ RUBY_PLATFORM)
print(msg + "\n")
return
end
print("\033[s") # Save cursor position
print("\r\033[K" + msg + "\n")
if input and input.prompt
print("\r\033[K")
print(input.prompt.tr("\001\002", ''))
print(input.line_buffer.tr("\001\002", ''))
print("\033[u\033[B") # Restore cursor, move down one line
end
=end
print(msg + "\n")
end