Skip to content

Commit 84ef5af

Browse files
committed
Ensure that scripts don't swallow errors
1 parent 42dbf54 commit 84ef5af

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

‎scripts/carthage.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env bash -e -o pipefail
22
#
33
# Needed to circumvent an issue with Carthage version < 0.37.0: https://.com/Carthage/Carthage/issues/3019
44
#
55
# carthage.sh
66
# Usage example: ./carthage.sh build --platform iOS
77

88
VERSION="$(carthage version)"
9-
"$(dirname "$0")/versions.sh" "$VERSION" "0.37.0"
9+
comparison=$("$(dirname "$0")/versions.sh" "$VERSION" "0.37.0"; echo $?)
1010

11-
if [ $? -ge 0 ]; then
11+
if [ $comparison -ge 0 ]; then
1212
# Carthage version is greater than or equal to 0.37.0 meaning we can use the --use-xcframeworks flag
1313
carthage "$@" --use-xcframeworks
1414
else

‎scripts/findproject.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env bash -e -o pipefail
22
#
33
# xcframework.sh
44
# Usage example: ./findproject.sh --project-name <project_name>

‎scripts/printformat.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env bash -e -o pipefail
22
#
33
# https://gist..com/SomeRandomiOSDev/798406a4a15f6b5d78b010599865c04f
44
#

‎scripts/resolvepath.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env bash -e -o pipefail
22
#
33
# resolvepath.sh
44
# Usage example: ./resolvepath.sh "./some/random/path/../../"

‎scripts/versions.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env bash -e -o pipefail
22
#
33
# versions.sh
44
# Usage example: ./versions.sh "1.4.15" "1.7.0"

‎scripts/workflowtests.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env bash -e -o pipefail
22
#
33
# workflowtests.sh
44
# Usage example: ./workflowtests.sh --no-clean
@@ -261,9 +261,9 @@ if which carthage >/dev/null; then
261261
CARTHAGE_VERSION="$(carthage version)"
262262
echo "Carthage: $CARTHAGE_VERSION"
263263

264-
"$SCRIPTS_DIR/versions.sh" "$CARTHAGE_VERSION" "0.37.0"
264+
comparison=$("$SCRIPTS_DIR/versions.sh" "$CARTHAGE_VERSION" "0.37.0"; echo $?)
265265

266-
if [ $? -lt 0 ]; then
266+
if [ $comparison -lt 0 ]; then
267267
"$SCRIPTS_DIR/printformat.sh" "foreground:yellow" "Carthage version of at least 0.37.0 is recommended for running these unit tests"
268268
fi
269269
else
@@ -274,9 +274,9 @@ fi
274274

275275
if which pod >/dev/null; then
276276
PODS_VERSION="$(pod --version)"
277-
"$SCRIPTS_DIR/versions.sh" "$PODS_VERSION" "1.7.3"
277+
comparison=$("$SCRIPTS_DIR/versions.sh" "$PODS_VERSION" "1.7.3"; echo $?)
278278

279-
if [ $? -ge 0 ]; then
279+
if [ $comparison -ge 0 ]; then
280280
echo "CocoaPods: $PODS_VERSION"
281281
else
282282
checkresult -1 "These unit tests require version 1.7.3 or later of CocoaPods: $("$SCRIPTS_DIR/printformat.sh" "foreground:blue;underline" "https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods")"

‎scripts/xcframework.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env bash -e -o pipefail
22
#
33
# xcframework.sh
44
# Usage example: ./xcframework.sh --output <some_path>/<name>.xcframework

0 commit comments

Comments
 (0)