From 1f43d1cc53d3ac8c0eae5c68906f530f9617df1c Mon Sep 17 00:00:00 2001 From: Joe Knapper Date: Wed, 18 Mar 2026 12:40:55 +0000 Subject: [PATCH 1/3] Explicit windows check before sigkill for mypy --- src/openflexure_microscope_server/stitching.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/openflexure_microscope_server/stitching.py b/src/openflexure_microscope_server/stitching.py index 49916e10..e6e92e6b 100644 --- a/src/openflexure_microscope_server/stitching.py +++ b/src/openflexure_microscope_server/stitching.py @@ -11,6 +11,7 @@ import os import shlex import signal import subprocess +import sys import threading from typing import IO, Optional @@ -221,7 +222,8 @@ class PreviewStitcher(BaseStitcher): except lt.exceptions.InvocationCancelledError as e: with self._popen_lock: if self._popen_obj is not None: - if IS_WINDOWS: + # mypy requires the check to be here + if sys.platform == "win32": # Windows has no SIGKILL self._popen_obj.kill() else: From 0618263830c50eabfcef0cb3da5fb055f35a8436 Mon Sep 17 00:00:00 2001 From: Joe Knapper Date: Wed, 18 Mar 2026 14:12:27 +0000 Subject: [PATCH 2/3] Switch to ignoring line --- src/openflexure_microscope_server/stitching.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/openflexure_microscope_server/stitching.py b/src/openflexure_microscope_server/stitching.py index e6e92e6b..6e9d5107 100644 --- a/src/openflexure_microscope_server/stitching.py +++ b/src/openflexure_microscope_server/stitching.py @@ -227,7 +227,8 @@ class PreviewStitcher(BaseStitcher): # Windows has no SIGKILL self._popen_obj.kill() else: - self._popen_obj.send_signal(signal.SIGKILL) + # ignore this line in mypy as mypy doesn't understand using the bool as a check + self._popen_obj.send_signal(signal.SIGKILL) # type: ignore[attr-defined] raise (e) From 91075af70e211bdcfa2a47a6160f03378212d88e Mon Sep 17 00:00:00 2001 From: Joe Knapper Date: Wed, 18 Mar 2026 14:51:32 +0000 Subject: [PATCH 3/3] Apply suggestions from code review of branch sigkill-handling Co-authored-by: Beth Probert --- src/openflexure_microscope_server/stitching.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/openflexure_microscope_server/stitching.py b/src/openflexure_microscope_server/stitching.py index 6e9d5107..311a00a4 100644 --- a/src/openflexure_microscope_server/stitching.py +++ b/src/openflexure_microscope_server/stitching.py @@ -11,7 +11,6 @@ import os import shlex import signal import subprocess -import sys import threading from typing import IO, Optional @@ -222,8 +221,7 @@ class PreviewStitcher(BaseStitcher): except lt.exceptions.InvocationCancelledError as e: with self._popen_lock: if self._popen_obj is not None: - # mypy requires the check to be here - if sys.platform == "win32": + if IS_WINDOWS: # Windows has no SIGKILL self._popen_obj.kill() else: