explorer.exe returns 1 on success — your spawn wrapper calls it failure
exit codes · case
Affectsnode, windows
Fails asEXIT CODE LEAK
Mechanismexit code propagation
Safe fixignore handoff exit
Symptom
Section titled “Symptom”“Reveal in folder” works — Explorer opens with the file selected — but the app logs an error every time, because execFileSync threw on a non-zero exit code.
execFileSync("explorer.exe", ["/select,", "C:\\file.txt"]);// throws: exit code 1 — yet the window opened correctlyexplorer.exe exits 1 even on success (it hands off to the running shell process and returns immediately). Exit-code-based success detection is structurally wrong for this binary.
Workaround
Section titled “Workaround”- Spawn detached, ignore the exit code, treat “spawn succeeded” as success (the referenced fire-and-forget fix).
- Generalize: for Windows shell-handoff binaries (explorer, start), never encode success as exit 0.