Skip to content

Commit 0237e87

Browse files
authored
Fix daemon showing visible console window on Windows (#101)
Use CREATE_NO_WINDOW instead of DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP when starting the daemon on Windows. DETACHED_PROCESS detaches from the parent console but still creates a new visible console window. CREATE_NO_WINDOW suppresses the window entirely. Fixes #100
1 parent bded244 commit 0237e87

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/cocoindex_code/client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,16 +205,16 @@ def start_daemon() -> None:
205205

206206
log_fd = open(log_path, "a")
207207
if sys.platform == "win32":
208-
# DETACHED_PROCESS fully detaches the daemon from the parent console,
209-
# preventing its exit code from leaking back to the calling shell.
210-
_create_new_process_group = 0x00000200
211-
_detached_process = 0x00000008
208+
# CREATE_NO_WINDOW prevents the daemon from showing a visible
209+
# console window. DETACHED_PROCESS alone is not sufficient —
210+
# it detaches from the parent console but still creates a new one.
211+
_create_no_window = 0x08000000
212212
subprocess.Popen(
213213
cmd,
214214
stdout=log_fd,
215215
stderr=log_fd,
216216
stdin=subprocess.DEVNULL,
217-
creationflags=_create_new_process_group | _detached_process,
217+
creationflags=_create_no_window,
218218
)
219219
else:
220220
subprocess.Popen(

0 commit comments

Comments
 (0)