This repository was archived by the owner on May 9, 2024. It is now read-only.
Add sudo to postinstall so that mkcert doesn't get hung up #321
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
This fixes an issue where, on MacOS Ventura (possibly others), if
~/Library/Application Support/mkcert/rootCA.pemdoesn't already exist, a hiddensudoprompt occurs, and the installation hangs forever.I attempted to use the
sudo.exec()method, but it causes an error to be thrown -SecTrustSettingsSetTrustSettings: The authorization was denied since no user interaction was possible- which seems related to this https://developer.apple.com/forums/thread/671582 .How to test the Change
~/Library/Application Support/mkcert/from your computer.sudo -kto make sure sudo isn't cached.npm uninstall -g wp-local-dockerto fully remove it.npm i -g wp-local-dockerto install it from the NPM Registry. Note that after a few mins it just stops. Behind the scenes it's waiting for asudopassword.To test this branch:
cdto the root of this repo.src/commands/postinstall.jsand comment out thereturnstatement on line 16. If you don't do this, the local installation will exit before making it to the problem command.npm i. You will be prompted for yoursudopassword whennpm run postinstallis executed, and this will carry through to themkcertcommand.~/Library/Application Support/mkcert/rootCA.pem.Changelog Entry
Credits
Props @ggutenberg
Checklist: