Re-sign electrobun's CLI binary so the app actually launches
`bun run start` printed nothing and exited 0 without ever opening a window. electrobun's prebuilt CLI is a Bun single-file executable whose payload is appended after the linker ad-hoc signed it, so `codesign -v` reports "code or signature have been modified" and the macOS kernel SIGKILLs it at exec. The failure was invisible because bin/electrobun.cjs spawns the real binary and forwards `process.exit(code || 0)` — a signal death has `code === null`. Confirmed upstream, not local corruption: a fresh download from the GitHub release hashes identical to the shipped copy and fails the same check. Both the darwin-arm64 and darwin-x64 CLI tarballs are affected. scripts/fix-electrobun-cli.ts re-seals the binary with `codesign --force --sign -`. It runs from postinstall AND ahead of every electrobun invocation, because the wrapper downloads the CLI lazily on first use rather than at install time — postinstall alone would no-op on a fresh checkout. When the binary is missing it provokes that download first, so a clean tree self-heals. It also fixes .cache/electrobun, which the wrapper restores bin/ from, and release.ts re-signs the Rosetta x64 CLI on download and on cache reuse. Idempotent (~0.3s when already valid) and a no-op off macOS. Verified from a deleted-binary state: `bun run start` downloads, re-signs and launches. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,21 @@ touching the adjacent code.
|
||||
|
||||
## Electrobun
|
||||
|
||||
- **The prebuilt CLI binary ships with a broken ad-hoc signature**, so macOS
|
||||
SIGKILLs it at exec and `bun run start` prints nothing and exits **0** —
|
||||
`bin/electrobun.cjs` spawns the real binary and forwards
|
||||
`process.exit(code || 0)`, and a signal death has `code === null`. The binary
|
||||
is a Bun single-file executable whose payload is appended *after* the linker
|
||||
signed it, so `codesign -v` reports "code or signature have been modified";
|
||||
the arm64 and x64 CLI tarballs are both affected upstream (confirmed by
|
||||
hashing a fresh download against the shipped copy — it is not local
|
||||
corruption, and re-installing does not help). `scripts/fix-electrobun-cli.ts`
|
||||
re-seals it with `codesign --force --sign -`. It runs from `postinstall`
|
||||
**and** ahead of every electrobun invocation, because the wrapper downloads
|
||||
the binary **lazily on first use**, not at install time — postinstall alone
|
||||
would no-op on a fresh checkout. It also fixes `.cache/electrobun`, which the
|
||||
wrapper restores `bin/` from. Never read a silent `exit 0` from the
|
||||
electrobun CLI as "nothing happened": run `codesign -v` on it first.
|
||||
- **Window `close` is not cancellable** (response type `{}`; only the
|
||||
app-level `before-quit` supports `event.response = {allow:false}`). All
|
||||
unsaved-state guards must either intercept app-controlled close paths
|
||||
|
||||
Reference in New Issue
Block a user