fix: installer tolerates localized 'service exists' (1073) and restarts the service if an upgrade step fails; 1.1.7
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -201,7 +201,8 @@ def install_service(install_dir_path: Path) -> None:
|
||||
exe = Path(install_dir_path) / "GTIFiscalAgentService" / "GTIFiscalAgentService.exe"
|
||||
bin_path = f"\"{exe}\""
|
||||
result = _sc(["create", SERVICE_NAME, "binPath=", bin_path, "start=", "auto", "DisplayName=", SERVICE_DISPLAY])
|
||||
if result.returncode != 0 and "already exists" not in (result.stdout + result.stderr):
|
||||
# 1073 = ERROR_SERVICE_EXISTS. Match the code, never the message: the text is localized (pt-BR: "já existe").
|
||||
if result.returncode not in (0, 1073) and "already exists" not in (result.stdout + result.stderr):
|
||||
raise RuntimeError(f"sc create failed: {result.stdout} {result.stderr}".strip())
|
||||
_sc(["config", SERVICE_NAME, "start=", "delayed-auto"])
|
||||
_sc(["config", SERVICE_NAME, "obj=", "LocalSystem"])
|
||||
|
||||
Reference in New Issue
Block a user