File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ def run(self):
26
26
class ReplProxy (object ):
27
27
def __init__ (self , repl ):
28
28
self ._repl = repl
29
+ self .expected_carets = 1
29
30
self ._repl_reader = ReplReader (repl )
30
31
# this is a hack to detect when we stop processing this input
31
32
self .send_input ('function prompt() {"^"}' )
@@ -57,6 +58,7 @@ def send_input(self, input):
57
58
# https://stackoverflow.com/questions/13229066/how-to-end-a-multi-line-command-in-powershell
58
59
if '\n ' in input :
59
60
input += '\n '
61
+ self .expected_carets = input .count ('\n ' )
60
62
61
63
self .expected_output_prefix = input .replace ('\n ' , '\n >> ' ) + '\n '
62
64
self .expected_output_len = len (self .expected_output_prefix )
@@ -91,7 +93,9 @@ def update_view_loop(self):
91
93
def write (self , packet ):
92
94
# this is a hack to detect when we stop processing this input
93
95
if packet == '^' :
94
- self .stop_flag = True
96
+ self .expected_carets -= 1
97
+ if self .expected_carets < 1 :
98
+ self .stop_flag = True
95
99
return
96
100
self .output += packet
97
101
You can’t perform that action at this time.
0 commit comments