Skip to content

Commit 445af29

Browse files
committed
Land rapid7#7739, async output revert until fixed
2 parents 0221d2d + 4098c66 commit 445af29

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

lib/rex/ui/text/input/readline.rb

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,16 +133,27 @@ def intrinsic_shell?
133133
private
134134

135135
def readline_with_output(prompt, add_history=false)
136-
# rb-readlines's Readline.readline hardcodes the input and output to $stdin and $stdout, which means setting
137-
# `Readline.input` or `Readline.ouput` has no effect when running `Readline.readline` with rb-readline, so need
138-
# to reimplement []`Readline.readline`](https://github.com/luislavena/rb-readline/blob/ce4908dae45dbcae90a6e42e3710b8c3a1f2cd64/lib/readline.rb#L36-L58)
139-
# for rb-readline to support setting input and output. Output needs to be set so that colorization works for the
140-
# prompt on Windows.
136+
# rb-readlines's Readline.readline hardcodes the input and output to
137+
# $stdin and $stdout, which means setting `Readline.input` or
138+
# `Readline.ouput` has no effect when running `Readline.readline` with
139+
# rb-readline, so need to reimplement
140+
# []`Readline.readline`](https://github.com/luislavena/rb-readline/blob/ce4908dae45dbcae90a6e42e3710b8c3a1f2cd64/lib/readline.rb#L36-L58)
141+
# for rb-readline to support setting input and output. Output needs to
142+
# be set so that colorization works for the prompt on Windows.
141143
self.prompt = prompt
144+
145+
# TODO: there are unhandled quirks in async output buffering that
146+
# we have not solved yet, for instance when loading meterpreter
147+
# extensions, supporting Windows, printing output from commands, etc.
148+
# Remove this guard when issues are resolved.
149+
=begin
142150
reset_sequence = "\n\001\r\033[K\002"
143151
if (/mingw/ =~ RUBY_PLATFORM)
144152
reset_sequence = ""
145153
end
154+
=end
155+
reset_sequence = ""
156+
146157
if defined? RbReadline
147158
RbReadline.rl_instream = fd
148159
RbReadline.rl_outstream = output

lib/rex/ui/text/output/stdio.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ def io
5858
# Use ANSI Control chars to reset prompt position for async output
5959
# SEE https://github.com/rapid7/metasploit-framework/pull/7570
6060
def print_line(msg = '')
61+
# TODO: there are unhandled quirks in async output buffering that
62+
# we have not solved yet, for instance when loading meterpreter
63+
# extensions, supporting Windows, printing output from commands, etc.
64+
# Remove this guard when issues are resolved.
65+
=begin
6166
if (/mingw/ =~ RUBY_PLATFORM)
6267
print(msg + "\n")
6368
return
@@ -70,6 +75,9 @@ def print_line(msg = '')
7075
print(input.line_buffer.tr("\001\002", ''))
7176
print("\033[u\033[B") # Restore cursor, move down one line
7277
end
78+
=end
79+
80+
print(msg + "\n")
7381
end
7482

7583
#

0 commit comments

Comments
 (0)