Skip to content

Conversation

@fredrikekelund
Copy link
Contributor

@fredrikekelund fredrikekelund commented Jan 26, 2026

Related issues

Proposed Changes

When Studio quits, the stopAllServers function runs the site stop --all CLI command to stop running sites. This function resolves if the command fails or if the Node.js ChildProcess instance emits an error event.

Unfortunately, when testing the Studio 1.7.0 Intel build on my Apple Silicon laptop (using Rosetta emulation) none of these things appear to happen. I don't yet know what happens for regular macOS Intel users, but there are some indications that stopAllServers does resolve. In any case, it's likely not working for me because the bundled node runtime initializes but can't proceed, getting stuck in an intermittent state.

To mitigate against similar issues in the future, this PR adds an optional timeout to the stopAllServers function that kills the child process and resolves the promise.

Testing Instructions

  1. Run npm start
  2. Wait a second or two
  3. Quit the app
  4. Ensure that it exits cleanly

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@fredrikekelund fredrikekelund requested a review from a team January 26, 2026 11:36
@fredrikekelund fredrikekelund self-assigned this Jan 26, 2026
@wpmobilebot
Copy link

📊 Performance Test Results

Comparing 18acad9 vs trunk

site-editor

Metric trunk 18acad9 Diff Change
load 2889.00 ms 2896.00 ms +7.00 ms 🔴 0.2%

site-startup

Metric trunk 18acad9 Diff Change
siteCreation 7063.00 ms 7080.00 ms +17.00 ms 🔴 0.2%
siteStartup 3937.00 ms 3919.00 ms -18.00 ms 🟢 -0.5%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change

Copy link
Contributor

@gcsecsey gcsecsey left a comment

Choose a reason for hiding this comment

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

Changes LGTM, and the process still exists cleanly.

Image

Copy link
Contributor

@epeicher epeicher left a comment

Choose a reason for hiding this comment

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

Thanks @fredrikekelund! I have tested it, and I can see that the application exits cleanly after different amounts of time. I left a minor comment, but this can progress anyway. LGTM!

Image

if ( shouldStopSitesOnQuit ) {
event.preventDefault();
stopAllServers( true )
stopAllServers( true, 6_000 )
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I think adding a constant with a meaningful name would help to identify what this number is

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.

5 participants