Skip to content

Commit bb3a11d

Browse files
committed
use ctrl-d to cancel input instead
1 parent f5f7b4d commit bb3a11d

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/rex/ui/text/shell.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,19 @@ def run(&block)
190190

191191
line = get_input_line
192192

193-
# If a block was passed in, pass the line to it. If it returns true,
194-
# break out of the shell loop.
195-
if block
196-
break if line == nil || block.call(line)
197-
198193
# If you have sessions active, this will give you a shot to exit
199194
# gracefully. If you really are ambitious, 2 eofs will kick this out
200-
elsif input.eof? || line == nil
195+
if input.eof? || line == nil
201196
self.stop_count += 1
202197
next if self.stop_count > 1
203198
run_single("quit")
204199

200+
# If a block was passed in, pass the line to it. If it returns true,
201+
# break out of the shell loop.
202+
elsif block
203+
break if line == nil || block.call(line)
204+
205+
205206
# Otherwise, call what should be an overriden instance method to
206207
# process the line.
207208
else
@@ -375,13 +376,12 @@ def get_input_line
375376
str = input.pgets
376377
if str
377378
line << str
378-
output.input = nil
379-
log_output(input.prompt)
380379
else
381-
self.stop_count += 1
382-
next if self.stop_count > 1
383-
run_single("quit")
380+
line = nil
384381
end
382+
383+
output.input = nil
384+
log_output(input.prompt)
385385
end
386386
self.cont_flag = false
387387

0 commit comments

Comments
 (0)