Closed guillaumealgis closed 8 years ago
:+1: thanks @guillaume-algis
@supermarin @kattrali LGTM
Thanks @guillaume-algis!
Looks good, altho I'd prefer using set -e for control flow. Merging to fix existing installations
Looks good, altho I'd prefer using set -e for control flow.
Not quite sure what you mean. We're already using set -e
. This is precisely why the script failed for some people. defaults read
returned 1
on the non-existing key, and set -e
halted the script.
Oh sorry, I reviewed from the phone.
Not sure how the &&
fixes the problem then
https://github.com/alcatraz/Alcatraz/pull/393/files?diff=split#diff-19783275db54420a49d7297671f8258eR13
Shouldn't the line fail on set -e
the same way &&
wouldn't continue?
You got me worried here for a minute. No, &&
prevent set -e
to halt the script (emph. mine):
The shell does not exit if the command that fails is part of the command list immediately following a
while
oruntil
keyword, part of the test in anif
statement, part of any command executed in a&&
or||
list except the command following the final&&
or||
[...]
So by using &&
we explicitly allow defaults read
to fail (which is reasonable). I just realized the script is still printing the defaults read
error though. A 2> /dev/null
is probably needed.
Fix https://github.com/alcatraz/Alcatraz/issues/392 #394
If Xcode never loaded any plugin, the
DVTPlugInManagerNonApplePlugIns-Xcode-$xcode_version
does not exist, and the script halted on the lineWe now check the return code of
default read
before continuing.Sorry about that :/