Skip to content

fix(installer): surface manage.sh stderr when Pulse install fails#1311

Open
stevetr68 wants to merge 1 commit into
danielmiessler:mainfrom
stevetr68:fix/installpulse-surface-stderr
Open

fix(installer): surface manage.sh stderr when Pulse install fails#1311
stevetr68 wants to merge 1 commit into
danielmiessler:mainfrom
stevetr68:fix/installpulse-surface-stderr

Conversation

@stevetr68
Copy link
Copy Markdown

Problem

When Pulse fails to install, installPulse() reports a generic message and discards the
real cause. It spawns manage.sh install with stderr piped, but never reads the pipe:

const installOk = await new Promise<boolean>((resolve) => {
  const child = spawn("bash", [manageScript, "install"], {
    cwd: pulseDir,
    stdio: ["ignore", "pipe", "pipe"],   // stderr piped...
  });
  const timer = setTimeout(() => { child.kill(); resolve(false); }, 30000);
  child.on("close", (code) => { clearTimeout(timer); resolve(code === 0); });  // ...but never read
  child.on("error", () => { clearTimeout(timer); resolve(false); });
});

if (!installOk) {
  await emit({ event: "message", content: "Pulse install command failed. Voice notifications will not be available." });
  return false;
}

So a real failure inside manage.sh (missing ~/Library/LaunchAgents, a sed/launchctl
error, etc.) is swallowed — the installer prints "install command failed" with no detail
and the user is left guessing.

Fix

Accumulate the already-piped stderr and include its tail in the failure message. No new
process behavior, no extra spawn — just stop throwing away output we're already capturing.

let installStderr = "";
// ...
child.stderr?.on("data", (chunk) => { installStderr += chunk.toString(); });
// ...
if (!installOk) {
  const tail = installStderr.trim().split("\n").slice(-20).join("\n");
  await emit({ event: "message", content: "Pulse install command failed. Voice notifications will not be available." + (tail ? "\nmanage.sh stderr (last lines):\n" + tail : "") });
  return false;
}

Pairs with #1310 — that fixes one common cause of the silent failure; this makes any
remaining cause visible instead of opaque.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant