Fix: Konsolenfenster bei Subprozessen unter Windows unterdrückt (v1.6.3)

subprocess.CREATE_NO_WINDOW-Flag in transform.py und worker_pool_base.py
gesetzt, damit beim Start aus einer PyInstaller-EXE keine Konsolenfenster
für Saxon, FOP und diff-pdf erscheinen.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 15:57:14 +02:00
parent 0f3c0dd878
commit 4ec5125ea2
7 changed files with 18 additions and 6 deletions
+8
View File
@@ -9,10 +9,14 @@ Dieses Modul implementiert die Transformations-Pipeline:
import logging
import subprocess
import sys
from pathlib import Path
from datetime import datetime
from typing import Any, Optional, TYPE_CHECKING
# Verhindert Konsolenfenster bei Subprozessen in PyInstaller-EXE (Windows)
_SUBPROCESS_FLAGS = subprocess.CREATE_NO_WINDOW if sys.platform == "win32" else 0
if TYPE_CHECKING:
from saxon_pool import SaxonWorkerPool
from saxon_pool_s9api import SaxonWorkerPoolS9Api
@@ -293,6 +297,7 @@ class TransformationJob:
capture_output=True,
text=True,
timeout=120, # 2 Minuten Timeout
creationflags=_SUBPROCESS_FLAGS,
)
# Saxon Ausgaben loggen
@@ -409,6 +414,7 @@ class TransformationJob:
capture_output=True,
text=True,
timeout=180, # 3 Minuten Timeout
creationflags=_SUBPROCESS_FLAGS,
)
# Apache FOP Ausgaben loggen
@@ -488,6 +494,7 @@ class TransformationJob:
capture_output=True,
text=True,
timeout=60, # 1 Minute Timeout
creationflags=_SUBPROCESS_FLAGS,
)
if result.returncode == 0:
@@ -523,6 +530,7 @@ class TransformationJob:
capture_output=True,
text=True,
timeout=90, # 1.5 Minuten Timeout
creationflags=_SUBPROCESS_FLAGS,
)
if result_diff.returncode == 0 or self.diff_pdf.exists():
+5 -1
View File
@@ -17,6 +17,9 @@ from abc import ABC, abstractmethod
from pathlib import Path
from typing import Optional
# Verhindert Konsolenfenster bei Subprozessen in PyInstaller-EXE (Windows)
_SUBPROCESS_FLAGS = subprocess.CREATE_NO_WINDOW if sys.platform == "win32" else 0
import psutil
from worker_metrics import WorkerPoolMetrics
@@ -133,7 +136,7 @@ class BaseWorkerPool(ABC):
logger.debug(f"Kompiliere {self._java_class_name}: {' '.join(javac_cmd[:3])}...")
result = subprocess.run(javac_cmd, capture_output=True, text=True, timeout=30)
result = subprocess.run(javac_cmd, capture_output=True, text=True, timeout=30, creationflags=_SUBPROCESS_FLAGS)
if result.returncode != 0:
raise RuntimeError(f"Java-Kompilierung fehlgeschlagen: {result.stderr}")
@@ -174,6 +177,7 @@ class BaseWorkerPool(ABC):
stderr=stderr_file,
text=True,
bufsize=1,
creationflags=_SUBPROCESS_FLAGS,
)
self.workers.append(process)