Skip to content

Commit

Permalink
Fix traceback when closing a Julia Basic Console (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsavol authored Feb 5, 2024
1 parent f6315e0 commit 28b2f06
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions spine_engine/execution_managers/persistent_execution_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,21 @@ def _start_persistent(self):

def _log_stdout(self):
"""Puts stdout from the process into the queue (it will be consumed by issue_command())."""
for line in iter(self._persistent.stdout.readline, b''):
data = line.decode("UTF8", "replace").rstrip()
self._msg_queue.put(dict(type="stdout", data=data))
try:
for line in iter(self._persistent.stdout.readline, b''):
data = line.decode("UTF8", "replace").rstrip()
self._msg_queue.put(dict(type="stdout", data=data))
except ValueError:
pass

def _log_stderr(self):
"""Puts stderr from the process into the queue (it will be consumed by issue_command())."""
for line in iter(self._persistent.stderr.readline, b''):
data = line.decode("UTF8", "replace").rstrip()
self._msg_queue.put(dict(type="stderr", data=data))
try:
for line in iter(self._persistent.stderr.readline, b''):
data = line.decode("UTF8", "replace").rstrip()
self._msg_queue.put(dict(type="stderr", data=data))
except ValueError:
pass

def make_complete_command(self, cmd):
lines = cmd.splitlines()
Expand Down

0 comments on commit 28b2f06

Please sign in to comment.