Skip to content

Commit

Permalink
Merge pull request #197 from jdidion/patch-1
Browse files Browse the repository at this point in the history
Fix unbound local variable error
  • Loading branch information
rhpvorderman authored Jun 4, 2024
2 parents f295bea + e5f06c9 commit 8e23a1e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pytest_workflow/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ def start(self):
# is started from multiple threads.
with self.start_lock:
if not self._started:
stdout_h = None
stderr_h = None
try:
stdout_h = self.stdout_file.open('wb')
stderr_h = self.stderr_file.open('wb')
Expand All @@ -91,8 +93,10 @@ def start(self):
self.errors.append(error)
finally:
self._started = True
stdout_h.close()
stderr_h.close()
if stdout_h is not None:
stdout_h.close()
if stderr_h is not None:
stderr_h.close()
else:
raise ValueError("Workflows can only be started once")

Expand Down

0 comments on commit 8e23a1e

Please sign in to comment.