-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Fixed wp-env start On Windows
#50895
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
Conversation
Since it's possible for the user creation to fail, it's possible that there will be no user by the given name to switch to. To prevent any errors we should switch to the UID:GID so that if the username was not created we don't error out.
|
Size Change: 0 B Total Size: 1.4 MB ℹ️ View Unchanged
|
noahtallen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes make sense to me; I'll let you and @t-hamano test it on Windows!
|
Flaky tests detected in f126963. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5062594083
|
|
Thanks @noahtallen, In the process of going through this pull request on Windows (natively) I managed to find a couple more issues with Windows that I resolved.
I've thoroughly tested these changes on both Windows and macOS to confirm that they don't break anything. It looks like Windows is working completely. @t-hamano I'm going to avoid merging this just yet, but, I'd like to get it in before tomorrow's automatic package release that way Windows will be functional again. |
t-hamano
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the quick response! Everything worked as expected.
I tested on a Windows host OS using the following commands:
git fetch origin fix/wp-env-windows-start
git checkout fix/wp-env-windows-start
npm run wp-env destroy
npm ci
npm run build
npm run wp-env start
- ✅ Started up with no problem
- ✅ Install and remove themes
- ✅ Install and remove plugins
- ✅ Uploading media
- ✅ Updating code using the theme editor
- ✅ Switching languages (i.e., downloading language files)
|
Thanks for the thorough review @t-hamano! |
What?
This pull request assigns an arbitrary
uidandgidof1000when runningwp-envfrom Windows natively (without using WSL).Closes #50814.
Why?
When we fixed the permission-related problems we introduced an incompatibility when running
wp-envusing Windows natively. While it does work with WSL, when used natively, theuidandgidare-1. We handled this case by assigning it auidandgidof0, but, this introduced other problems with trying to run everything asroot.How?
We just assign an arbitrary
uidandgid. This should work fine because Windows is already performing magic for us with filesystem permissions to get everything in working order in the first place. It doesn't really matter to Windows what the user is because the Docker container has full permissions.Testing Instructions
nodeon Windows without using WSL. Meaning you should be able to run it from PowerShell or CMD.npx wp-env startfrom Windows without using WSL. It should boot correctly without any problems.