Skip to content

Commit

Permalink
Allow process to already not exist when trying to kill it (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshKarpel authored Oct 25, 2024
1 parent c71d151 commit 5237071
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 9 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## `0.0.4`

Released `2024-10-24`

### Fixed

- [#79](https://github.com/JoshKarpel/synthesize/pull/79)
Fix a crash that could happen when a process exits while we are trying to terminate it.

## `0.0.3`

Released `2024-07-07`
Expand Down
6 changes: 5 additions & 1 deletion synthesize/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ def _send_signal(self, signal: int) -> None:
if self.has_exited:
return None

os.killpg(os.getpgid(self.process.pid), signal)
try:
os.killpg(os.getpgid(self.process.pid), signal)
except ProcessLookupError:
# process exited before we could send the signal
pass

def terminate(self) -> None:
self._send_signal(SIGTERM)
Expand Down

0 comments on commit 5237071

Please sign in to comment.