Skip to content

Commit df2fced

Browse files
committed
tests: fix flaky daemon start on Windows by ignoring launcher rc and polling socket
1 parent c8b44a9 commit df2fced

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

src/tests/test_concurrent_install.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,33 +189,32 @@ def ensure_daemon_running(interpreter_paths: list) -> bool:
189189
_is_win = sys.platform == "win32"
190190
proc = subprocess.Popen(
191191
["8pkg", "daemon", "start"],
192-
stdout=subprocess.DEVNULL,
193-
stderr=subprocess.DEVNULL,
192+
stdout=subprocess.PIPE,
193+
stderr=subprocess.PIPE,
194194
)
195-
# Poll until daemon answers, launcher exits with error, or we time out.
195+
# Poll until daemon answers or we time out.
196+
# Do NOT bail on launcher rc — on Windows the launcher exits with
197+
# rc=1 even when the daemon it spawned is still starting (detached).
198+
# The only reliable signal is the socket answering.
199+
_launcher_logged = False
196200
_came_up = False
197201
for i in range(60):
198202
time.sleep(0.5)
199203
rc = proc.poll()
200-
if rc is not None and rc != 0:
201-
# Launcher exited non-zero — bail immediately, don't burn
202-
# the remaining 30s pretending the daemon might appear.
204+
if rc is not None and not _launcher_logged:
205+
_launcher_logged = True
203206
try:
204207
_out = proc.stdout.read().decode("utf-8", errors="replace").strip()
205208
_err = proc.stderr.read().decode("utf-8", errors="replace").strip()
206209
except Exception:
207210
_out = _err = ""
208-
safe_print(f" Launcher exited rc={rc}daemon start failed")
211+
safe_print(f" ℹ️ Launcher exited rc={rc}polling socket for daemon")
209212
if _out:
210213
for ln in _out.splitlines():
211214
safe_print(f" [launcher stdout] {ln}")
212215
if _err:
213216
for ln in _err.splitlines():
214217
safe_print(f" [launcher stderr] {ln}")
215-
dump_daemon_log("DAEMON LOG ON FAILURE", only_on_error=False)
216-
return False
217-
if rc == 0 and i == 0:
218-
safe_print(" ℹ️ Launcher exited rc=0 — daemon detached")
219218
status = client.status()
220219
if status.get("success"):
221220
_daemon_elapsed = (time.perf_counter() - _daemon_start) * 1000

0 commit comments

Comments
 (0)