Skip to content

Fix CLI child process cleanup on app quit - #2997

Merged
wojtekn merged 3 commits into
trunkfrom
fix-cli-child-process-cleanup-on-quit
Apr 7, 2026
Merged

Fix CLI child process cleanup on app quit#2997
wojtekn merged 3 commits into
trunkfrom
fix-cli-child-process-cleanup-on-quit

Conversation

@wojtekn

@wojtekn wojtekn commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Related issues

  • Fixes flaky E2E blueprints tests (ENOTEMPTY on session cleanup)

How AI was used in this PR

Claude identified the root cause and implemented the fix.

Proposed Changes

  • e2e-helpers.ts: Retry rimraf on ENOTEMPTY (up to 5 times, 500ms apart) as a safety net for any remaining race on session cleanup.

Testing Instructions

  • Run the blueprints E2E tests: npm run e2e -- blueprints
  • Verify no ENOTEMPTY errors appear in test cleanup
  • Manually open a site, run a blueprint-based site creation, then quit the app — confirm it exits cleanly without leaving orphaned processes

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@wojtekn
wojtekn requested a review from a team April 7, 2026 08:14
@wojtekn wojtekn self-assigned this Apr 7, 2026
@wpmobilebot

wpmobilebot commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 782188e vs trunk

app-size

Metric trunk 782188e Diff Change
App Size (Mac) 1263.86 MB 1263.86 MB +0.00 MB ⚪ 0.0%

site-editor

Metric trunk 782188e Diff Change
load 1887 ms 1826 ms 61 ms 🟢 -3.2%

site-startup

Metric trunk 782188e Diff Change
siteCreation 8184 ms 8161 ms 23 ms ⚪ 0.0%
siteStartup 4833 ms 4866 ms +33 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@fredrikekelund fredrikekelund left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't recall… The E2E tests are flaky on macOS, right? Did we try to simply pass some combination of maxRetries, backoff, maxBackoff, and retryDelay to the rimraf call in apps/studio/e2e/e2e-helpers.ts?

rimraf has a pretty generous default retry config on Windows. Much less so on macOS.

Comment thread apps/studio/e2e/e2e-helpers.ts Outdated
@wojtekn

wojtekn commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

@fredrikekelund it seems it doesn't handle ENOTEMPTY:

exports.codes = new Set(['EMFILE', 'ENFILE', 'EBUSY']);
@wojtekn
wojtekn force-pushed the fix-cli-child-process-cleanup-on-quit branch from 9632afc to 782188e Compare April 7, 2026 08:38
@wojtekn

wojtekn commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

I removed changes in execute-command.ts for now to see if e2e improvement is enough to fix the issue.

@wojtekn
wojtekn merged commit 321d1db into trunk Apr 7, 2026
11 checks passed
@wojtekn
wojtekn deleted the fix-cli-child-process-cleanup-on-quit branch April 7, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants