cmd/prof: raise error when cmd is bash file#10280
Merged
MikeMcQuaid merged 2 commits intoHomebrew:masterfrom Jan 18, 2021
Merged
cmd/prof: raise error when cmd is bash file#10280MikeMcQuaid merged 2 commits intoHomebrew:masterfrom
MikeMcQuaid merged 2 commits intoHomebrew:masterfrom
Conversation
MikeMcQuaid
reviewed
Jan 11, 2021
Member
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Thanks @hyuraku! some comments.
Library/Homebrew/commands.rb
Outdated
| end | ||
|
|
||
| def only_bash_command_list | ||
| internal_commands.reject { |cmd| valid_internal_cmd?(cmd) } |
Member
There was a problem hiding this comment.
I think this function makes sense but not the implementation. This should check for a file extension instead.
Library/Homebrew/brew.rb
Outdated
| end | ||
| exec "brew-#{cmd}", *ARGV | ||
| else | ||
| raise "command made by bash not ruby: #{cmd}" if Commands.only_bash_command_list.include?(cmd) |
Member
There was a problem hiding this comment.
It doesn't seem like this should be in brew.rb but prof.rb instead.
MikeMcQuaid
reviewed
Jan 11, 2021
Library/Homebrew/dev-cmd/prof.rb
Outdated
Member
There was a problem hiding this comment.
Suggested change
| raise "#{cmd} is made by bash not ruby" if Commands.path(cmd).extname == ".sh" | |
| raise UsageError, "#{cmd} is a Bash command!" if Commands.path(cmd).extname == ".sh" |
76f1a7c to
c56fff3
Compare
Contributor
Author
|
@MikeMcQuaid |
MikeMcQuaid
approved these changes
Jan 18, 2021
Member
|
Thanks again @hyuraku! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
brew stylewith your changes locally?brew typecheckwith your changes locally?brew testswith your changes locally?brew manlocally and committed any changes?brew prof updatecaused an error becauseupdateis made by bash, not ruby. However, the error messageError: Unknown command: updatewas not correct, so I added the correct message.