Skip to content

Commit 272f187

Browse files
committed
Potential fix for cell caching issue
1 parent e418eb0 commit 272f187

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

powershell_kernel/powershell_proxy.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def run(self):
2626
class ReplProxy(object):
2727
def __init__(self, repl):
2828
self._repl = repl
29+
self.expected_carets = 1
2930
self._repl_reader = ReplReader(repl)
3031
# this is a hack to detect when we stop processing this input
3132
self.send_input('function prompt() {"^"}')
@@ -57,6 +58,7 @@ def send_input(self, input):
5758
# https://stackoverflow.com/questions/13229066/how-to-end-a-multi-line-command-in-powershell
5859
if '\n' in input:
5960
input += '\n'
61+
self.expected_carets = input.count('\n')
6062

6163
self.expected_output_prefix = input.replace('\n', '\n>> ') + '\n'
6264
self.expected_output_len = len(self.expected_output_prefix)
@@ -91,7 +93,9 @@ def update_view_loop(self):
9193
def write(self, packet):
9294
# this is a hack to detect when we stop processing this input
9395
if packet == '^':
94-
self.stop_flag = True
96+
self.expected_carets -= 1
97+
if self.expected_carets < 1:
98+
self.stop_flag = True
9599
return
96100
self.output += packet
97101

0 commit comments

Comments
 (0)