Skip to content

Commit cdaed43

Browse files
yamatonkdm9
andauthored
Remove trailing backslash before executing code (#133)
* Remove trailing backslash before executing code * error on trailing backslash --------- Co-authored-by: Dr. K. D. Murray <1560490+kdm9@users.noreply.github.com>
1 parent 4a47b36 commit cdaed43

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

bash_kernel/kernel.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,18 @@ def do_execute(self, code, silent, store_history=True,
190190
return {'status': 'ok', 'execution_count': self.execution_count,
191191
'payload': [], 'user_expressions': {}}
192192

193+
194+
if code.strip().endswith("\\"):
195+
error_content = {
196+
'ename': '',
197+
'evalue': "Cell has trailing backslash",
198+
'traceback': []
199+
}
200+
self.send_response(self.iopub_socket, 'error', error_content)
201+
error_content['execution_count'] = self.execution_count
202+
error_content['status'] = 'error'
203+
return error_content
204+
193205
interrupted = False
194206
try:
195207
# Note: timeout=None tells IREPLWrapper to do incremental

0 commit comments

Comments
 (0)