fix: installer stops the service reliably before upgrading and retries locked file copies; 1.1.5

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
gti
2026-09-24 09:46:00 -03:00
co-authored by Claude Sonnet 5
parent e40e9500a4
commit 71bbf3e0bd
20 changed files with 44 additions and 27 deletions
+10
View File
@@ -213,6 +213,16 @@ def stop_service() -> None:
_sc(["stop", SERVICE_NAME])
def ensure_service_stopped(timeout: float = 45.0) -> None:
"""Stop the service and make sure its host process is really gone (an upgrade must be able
to overwrite the executable): SCM stop, wait, then kill any leftover host process."""
stop_service()
if not wait_service_state("STOPPED", timeout=timeout):
subprocess.run(["taskkill", "/F", "/IM", "GTIFiscalAgentService.exe"], capture_output=True, text=True)
wait_service_state("STOPPED", timeout=15)
time.sleep(2)
def remove_service() -> None:
"""Stop then delete the service; both best effort (idempotent)."""
stop_service()