Skip to content

Commit

Permalink
Catch ValueError, which happens when a Julia installed from Microsoft…
Browse files Browse the repository at this point in the history
… Store is closed

Re spine-tools/Spine-Toolbox#2558
  • Loading branch information
ptsavol committed Feb 5, 2024
1 parent f6315e0 commit 21f9f04
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 21f9f04

Please sign in to comment.