Fix PATH override in syncdb command#43
Conversation
There was a problem hiding this comment.
Pull request overview
Adjusts the host-side syncdb DDEV command so it no longer overwrites the user’s existing PATH, fixing cases where ddev is no longer discoverable (e.g., Homebrew installs on Apple Silicon).
Changes:
- Prepend
~/.ddev/wunderio/core/to the existingPATHinstead of replacing it entirely.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| ## ProjectTypes: drupal9,drupal10,drupal11 | ||
|
|
||
| export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:$HOME/.ddev/wunderio/core/ | ||
| export PATH="$HOME/.ddev/wunderio/core/:$PATH" |
There was a problem hiding this comment.
If $PATH is unset/empty in the environment, this expands to a trailing : (empty PATH entry), which implicitly adds the current working directory to PATH on many shells. Consider guarding for an empty/unset PATH (e.g., only append :$PATH when non-empty, or use ${PATH:+:$PATH}) to avoid accidentally including . in the executable search path.
| export PATH="$HOME/.ddev/wunderio/core/:$PATH" | |
| export PATH="$HOME/.ddev/wunderio/core/${PATH:+:$PATH}" |
Overwriting the PATH completely makes the
syncdbcommand fail with~/.ddev/wunderio/core/tooling/syncdb.sh: line 60: ddev: command not found(Apple silicon Mac, DDEV installed via Homebrew). Let's prepend the wunderio dir to the existing PATH instead.