File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
lib/rex/post/sql/ui/console Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -80,19 +80,24 @@ def _multiline
80
80
81
81
finished = false
82
82
begin
83
+ result = nil
83
84
prompt_proc_before = ::Reline . prompt_proc
84
85
::Reline . prompt_proc = proc { |line_buffer | line_buffer . each_with_index . map { |_line , i | i > 0 ? 'SQL *> ' : 'SQL >> ' } }
85
86
86
87
# We want to do this in a loop
87
88
# multiline_input is the whole string that the user has input, not just the current line.
88
89
raw_query = ::Reline . readmultiline ( 'SQL >> ' , use_history = true ) do |multiline_input |
89
90
# The user pressed ctrl + c or ctrl + z and wants to background our SQL prompt
90
- return { status : :exit , result : nil } unless self . interacting
91
+ unless self . interacting
92
+ result = { status : :exit , result : nil }
93
+ next true
94
+ end
95
+
91
96
# When the user has pressed the enter key with no input, don't run any queries;
92
97
# simply give them a new prompt on a new line.
93
98
if multiline_input . chomp . empty?
94
- print_blank_line
95
- return { status : :success , result : nil }
99
+ result = { status : :success , result : nil }
100
+ next true
96
101
end
97
102
98
103
# In the case only a stop word was input, exit out of the REPL shell
@@ -106,6 +111,10 @@ def _multiline
106
111
::Reline . prompt_proc = prompt_proc_before
107
112
end
108
113
114
+ if result
115
+ return result
116
+ end
117
+
109
118
if finished
110
119
self . interacting = false
111
120
print_status 'Exiting Shell mode.'
You can’t perform that action at this time.
0 commit comments