Page MenuHomePhabricator

[docs] Use a double ampersand in chained bash commands
ClosedPublic

Authored by max on Apr 11 2022, 2:00 AM.
Tags
None
Referenced Files
F3392616: D3685.diff
Sat, Nov 30, 9:29 AM
Unknown Object (File)
Fri, Nov 22, 2:01 PM
Unknown Object (File)
Fri, Nov 22, 2:01 PM
Unknown Object (File)
Fri, Nov 22, 2:01 PM
Unknown Object (File)
Fri, Nov 22, 2:01 PM
Unknown Object (File)
Fri, Nov 22, 1:59 PM
Unknown Object (File)
Thu, Nov 14, 8:58 AM
Unknown Object (File)
Fri, Nov 8, 12:47 AM

Details

Summary

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.

Test Plan

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

max retitled this revision from [docs] PHP installation - change to double ampersand to [docs] PHP installation - change brew command to double ampersand.Apr 11 2022, 3:57 AM
ashoat requested changes to this revision.Apr 11 2022, 6:43 AM
ashoat added a subscriber: varun.

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.

This revision now requires changes to proceed.Apr 11 2022, 6:43 AM
This revision now requires review to proceed.Apr 11 2022, 6:44 AM
varun requested changes to this revision.Apr 12 2022, 12:40 PM

What's the problem that this diff solves? Need more context

This revision now requires changes to proceed.Apr 12 2022, 12:40 PM

Update all the double commands with the && instead of ;.

max retitled this revision from [docs] PHP installation - change brew command to double ampersand to [docs] Use double ampersand in double bash commands.Apr 18 2022, 7:52 AM
max edited the summary of this revision. (Show Details)
max retitled this revision from [docs] Use double ampersand in double bash commands to [docs] Use a double ampersand in chained bash commands.
In D3685#102203, @varun wrote:

What's the problem that this diff solves? Need more context

I've updated the description with more context on it and the diff as well. I think it's more clear now.

ashoat requested changes to this revision.Apr 18 2022, 8:54 PM
This comment was removed by ashoat.
This revision now requires changes to proceed.Apr 18 2022, 8:54 PM

Will brew install php@7.4 return a non-zero exit code if the package in question is already installed?

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.

Thanks!! Appreciate the clarification

This revision now requires review to proceed.Apr 21 2022, 9:44 AM
This revision is now accepted and ready to land.Apr 21 2022, 9:49 AM