-
Notifications
You must be signed in to change notification settings - Fork 823
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
FIX 'which' check in 'sake' now works for aliases #11232
FIX 'which' check in 'sake' now works for aliases #11232
Conversation
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.
Docs for the command
command for future reference.
@michalkleiner and @minimalic can you please confirm if this works for you? I note there was discussion about the alternative PR, but hopefully this PR works for all those cases.
Improves on the current implementations since 'command' already only returns executable commands. Additionally, the success output of 'command' is not standardized and may contain additional information. Therefore, a 'test' if the result of 'command' is a valid executable file, may fail incorrectly. Now just relying on the standardized exit status of 'command -v'.
The previous implementation used '&&' piping wich is handled differently in PHP and Bash code and therefore, may be confusing to a PHP developer. I refactored the function to use a traditional if statement.
Converted to 'if' to square bracket based testing to be in comply with the other 'if' statements in the script. Co-authored-by: Guy Sartorelli <[email protected]>
14f2608
to
01efd26
Compare
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.
LGTM, works well locally.
Retargetted to 5.2
so it can be released as a patch. Will merge when CI goes green.
Description
sake
may wrongly exit early on itswhich
check, since the current implementation does the following:command -v
information about thewhich
executableThis 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 sincecommand -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, wherewhich
itself has been aliased.Issues
Pull request checklist