-
Notifications
You must be signed in to change notification settings - Fork 357
[CLI] Avoid breaks during Playground boot when --xdebug enabled
#2835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
|
It looks like Xdebug support relies upon being set up in the initial worker. Currently, this PR breaks the Xdebug feature. Will look at fixing that. |
It turns out that, even though we were relaying the The v2 worker appears to consider the xdebug flag for both initial and subsequent workers. |
|
This is almost ready. There are a few remaining test failures, and I'm looking at those. |
The tmp-promise lib handles temp dir cleanup in the case of exit, and our full cleanup is async which cannot be guaranteed to finish when exiting via process.exit().
|
It turns out that using a using a pool of non-initial workers revealed some bugs like:
These are now fixed, and the tests are passing again. I think this is ready for review. Note, this PR includes some cleanup-related refactor from #2836, and it would probably make more sense to review that one before this one. |
Motivation for the change, related issues
Today, Playground enables Xdebug during boot which may be surprising to users. If the debugger breaks at the first line, the user will be debugging the Playground boot process. Let's skip this by default and consider adding a command line flag to enable boot-time Xdebug breaks.
Implementation details
A big change in this PR is that the first Playground worker is now only used during boot. We discard it after that boot and setup process completes. Some positive consequences of this change are:
Testing Instructions (or ideally a Blueprint)
Before checking out this branch:
/wordpressnpx nx unbuilt-asyncify playground-cli -- server --mount-dir <local-dir> /wordpressso Playground will download and install WordPress in your local directory.cdinto the local WP dir and run the following command and confirm that vscode hit a breakpoint before the "WordPress is running on http://127.0.0.1:9400" message is printed:node --experimental-strip-types --experimental-transform-types --disable-warning=ExperimentalWarning --import ../packages/meta/src/node-es-module-loader/register.mts ../packages/playground/cli/src/cli.ts server --auto-mount=. --verbosity=debug --skip-wordpress-setup --xdebug --experimental-unsafe-ide-integration --php=8.3 --experimental-multi-worker=4After checking out this branch:
cdinto the local WP dir, re-run the above node command, and confirm that no breakpoint was hit during the boot process.