From e43d6ea6668794e03c056038b893b9dce84d7ad1 Mon Sep 17 00:00:00 2001 From: jennyf19 <19942418+jennyf19@users.noreply.github.com> Date: Mon, 20 Jul 2026 11:41:51 -0700 Subject: [PATCH] signals-dashboard: trySpawn resolves only from spawn/error Synced from the-workshop@3cd8a0c6a1e24864d746fedb1f2f7ee4f3b17603. Round-4 review: remove the success timeout that could report an unconfirmed launch as launched:true; Node guarantees one of spawn/error fires. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 26faf13e-639c-4a21-ac05-c0dc2bff7c62 --- extensions/signals-dashboard/extension.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extensions/signals-dashboard/extension.mjs b/extensions/signals-dashboard/extension.mjs index 6afbc10c..33787545 100644 --- a/extensions/signals-dashboard/extension.mjs +++ b/extensions/signals-dashboard/extension.mjs @@ -53,7 +53,9 @@ function deskOrientPrompt(deskName) { // Spawn detached and resolve true only once the OS confirms the process // started ('spawn'), false on failure ('error', e.g. the binary is missing) so -// the caller can fall back. A short timer guards the rare case neither fires. +// the caller can fall back. Node guarantees exactly one of those events fires +// for a spawn attempt, so we resolve solely from them — no timeout that could +// report an unconfirmed launch as success and skip the clipboard fallback. function trySpawn(cmd, args, opts = {}) { return new Promise((resolve) => { let settled = false; @@ -67,7 +69,6 @@ function trySpawn(cmd, args, opts = {}) { const child = spawn(cmd, args, { detached: true, stdio: "ignore", ...opts }); child.on("error", () => done(false)); child.on("spawn", () => done(true, child)); - setTimeout(() => done(true, child), 600); } catch { resolve(false); } }); }