From 8537bdd75ad6291753b5169c6220ab603d55706e Mon Sep 17 00:00:00 2001 From: asorry75 Date: Fri, 31 Jul 2026 21:46:40 +0800 Subject: [PATCH] fix: hide cmd.exe black window on Windows startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add CREATE_NO_WINDOW creationflag to subprocess.call() in _run_pg0() to prevent a visible black cmd.exe window when starting PostgreSQL. The flag only suppresses the console window allocation — subprocess.call() remains synchronous and blocks until pg0.exe exits as before. Closes #32 --- sdk/python/pg0/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/python/pg0/__init__.py b/sdk/python/pg0/__init__.py index 8428efb..3972233 100644 --- a/sdk/python/pg0/__init__.py +++ b/sdk/python/pg0/__init__.py @@ -143,6 +143,10 @@ def _run_pg0(*args: str, check: bool = True) -> subprocess.CompletedProcess: [pg0_path, *args], stdout=out_f, stderr=err_f, + # Windows: hide the console window. Without this, launching + # pg0 (and the postgres it spawns via cmd /C) pops a visible + # black cmd window on the desktop. + creationflags=getattr(subprocess, "CREATE_NO_WINDOW", 0), ) out_f.seek(0) err_f.seek(0)