Skip to content

fix(cli): warn when postinstall auto-update sync fails - #73

Open
ZayanKhan-12 wants to merge 1 commit into
MetaMask:mainfrom
ZayanKhan-12:fix/postinstall-swallowed-exit-code
Open

fix(cli): warn when postinstall auto-update sync fails#73
ZayanKhan-12 wants to merge 1 commit into
MetaMask:mainfrom
ZayanKhan-12:fix/postinstall-swallowed-exit-code

Conversation

@ZayanKhan-12

Copy link
Copy Markdown

Description

In postinstall() in bin/metamask-skills.mjs, the exit code from the auto-update sync delegate was discarded by a ternary that returns 0 on both branches:

const result = delegate('sync', target, repo, passthrough);
return result === 0 ? 0 : 0;

So when the delegated sync script exits non-zero (e.g. the bash delegate fails, or spawnSync can't start it and delegate returns 1), the failure is silently ignored — while thrown errors in the same path do emit a warning via the catch block.

This change keeps the intentional never-fail contract of postinstall (a failed auto-update should not break npm install, so it still returns 0), but surfaces the failure the same way the catch path does:

const result = delegate('sync', target, repo, passthrough);
if (result !== 0) {
  warn(`auto-update failed with exit code ${result}`);
}
return 0;

Testing

  • node --test test/*.test.mjs — 36/36 pass
  • node bin/metamask-skills.mjs --help smoke check passes

🤖 Generated with Claude Code

The postinstall auto-update discarded the sync delegate's exit code
with a ternary that returned 0 on both branches, so a failed sync was
silently ignored. Thrown errors in the same path already emit a
warning; non-zero exit codes now do too. Postinstall still exits 0 so
a failed auto-update never breaks npm install.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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