Instead of running the second (right) bash install command anyway (even if the first one failed), we should use && to run it only when the first (left) command is successful. This is solved by switching from ; to && when chaining the commands together.
Details
For example: running brew install php@7.4; brew upgrade php@7.4 the first (left) command can fail in case the current version is unavailable or due to the local brew dependencies problem. In that case, the right command will be invoked anyway and of course, will fail too.
If we chain the commands with the && instead, the execution will stop at the first failed command and we will not execute the next one in the commands chain.
Diff Detail
- Repository
- rCOMM Comm
- Branch
- docs-php-nit-fix
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
CONSISTENCY MATTERS IN DOCS
You're changing one example of a line that appears dozens of times in the docs. Every time anybody on the team submits a docs diff, I find myself repeating the same thing over and over... YOU must be the editor. It is YOUR responsibility to maintain consistency of voice and style. @geekbrother, here you are ruining the consistency by introducing a change that is not reflected elsewhere in the docs.
Please, please, please keep this in mind going forward. I am getting increasingly frustrated by the fact that nobody on the team seems to take this responsibility seriously.
Please do not pass docs diffs to me until @varun has taken a look
Second point – because very few people on the team are able to submit or review docs diffs, and because I get very frustrated when passed a docs diff, we have a new system in place where all docs diffs go through @varun first. Please do not pass me docs diffs until @varun has taken a look, because the chance of getting a response like this is >80% (just looking at the numbers).
You need a lot more details in your test plan
The diff only changes behavior if brew install node@16 return a non-zero exit code. In order to evaluate this diff, we need to know in what scenarios brew install node@16 will return a non-zero exit code. @geekbrother, you'll need to provide this info. It would also be helpful to understand what problem exactly you're solving here, or what issue you encountered that led you to put up this diff.
I've updated the description with more context on it and the diff as well. I think it's more clear now.
Will brew install php@7.4 return a non-zero exit code if the package in question is already installed?
If the package is already installed brew throws a zero code.
The reason why I put up these changes:
The first command failed when I had a bad network and the brew failed to download something but started to update from the second command.
The expected behavior was that we stop on the first command if it fails.