silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
720 stars 820 forks source link

FIX 'which' check in 'sake' now works for aliases #11232

Closed NoLdman closed 1 month ago

NoLdman commented 1 month ago

Description

sake may wrongly exit early on its which check, since the current implementation does the following:

  1. Retrieves via command -v information about the which executable
  2. Tries to check the returned information string, if it is executable.

This solution is problematic since the returned information string may include alias information (and more), which test -x can not interpret.

Additionally is the test -x check unnecessary since command -v already only returns executable command or fails if the command can not be found.

Therefore, I changed the source to just check for the exit status of command -v.

Manual testing steps

Run vendor/bin/sake dev/build on a POSIX compliant system, where which itself has been aliased.

Issues

Pull request checklist