Skip to content

fix: exit completed CLI commands - #2574

Open
trungtin wants to merge 2 commits into
wxt-dev:mainfrom
trungtin:agent/fix-cli-command-hang
Open

fix: exit completed CLI commands#2574
trungtin wants to merge 2 commits into
wxt-dev:mainfrom
trungtin:agent/fix-cli-command-hang

Conversation

@trungtin

@trungtin trungtin commented Aug 4, 2026

Copy link
Copy Markdown

Overview

WXT evaluates extension entrypoints in Node while running one-shot commands such as wxt prepare. If an imported dependency creates a referenced Node handle (for example, a BroadcastChannel), WXT prints Finished but the CLI process never exits. This also leaves package-manager lifecycle scripts such as postinstall: wxt prepare stuck indefinitely.

This change explicitly exits successful, completed CLI actions after their final log. Long-running commands are unchanged: wxt dev already returns { isOngoing: true }, so it continues running normally.

The regression test launches the real TypeScript CLI with Node against an extension whose background entrypoint contains:

new BroadcastChannel('wxt-prepare-test');

export default defineBackground(() => {});

Without the fix, the child process reaches Finished and is killed by the five-second test timeout. With the fix, it exits with code 0.

Manual Testing

  • bun run --filter wxt test run e2e/tests/cli.test.ts
  • bun run --filter wxt test run src/cli/__tests__/index.test.ts (53 tests)
  • bun run --filter wxt check
  • bun run --filter wxt test run (51 files, 538 passed, 2 skipped, 2 todo)

Related Issue

Related to #1841.

@netlify

netlify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 3c1aa3c
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/6a71e64328df11000802a01f
😎 Deploy Preview https://deploy-preview-2574--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the pkg/wxt Includes changes to the `packages/wxt` directory label Aug 4, 2026
@trungtin
trungtin marked this pull request as ready for review August 4, 2026 13:17
@trungtin
trungtin requested a review from aklinker1 as a code owner August 4, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg/wxt Includes changes to the `packages/wxt` directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant