Skip to content

Commit a1f41c3

Browse files
committed
Use subshells without unnecessarily generating any string from their output
1 parent dbb3fff commit a1f41c3

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

test/all.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,36 @@ env_vars_tail="BUILD_NAME=my-build\nVERSION=1.0.1\nQUALITY_GATE=B (ERROR)\nWITH_
5454
missing_text="_(no notification provided)_"
5555

5656
username="concourse"
57-
# Turn off failure on failed command return because we can't exit the script when we EXPECT a failure from a test
57+
58+
# Turn off failure on failed command return because we can't exit the script
59+
# when we EXPECT a failure from a test
5860
set +e
5961

60-
# Run these in a subshell so that the subshell process exits itself. If we don't run in a subshell the exit will exit THIS process
61-
$(test curl_failure)
62-
if [ $? -eq 0 ]; then # Since we EXPECT failure from these tests, assert that they come back with a "bad" non-zero status code.
62+
(
63+
# Run these in a subshell so that the subshell process exits itself. If we
64+
# don't run in a subshell the exit will exit THIS process
65+
test curl_failure
66+
)
67+
# Since we EXPECT failure from these tests, assert that they come back with a
68+
# "bad" non-zero status code
69+
if [ $? -eq 0 ]; then
6370
exit 1
6471
else
6572
echo_true
6673
fi
6774

68-
$(test curl_failure_with_silent)
75+
(
76+
test curl_failure_with_silent
77+
)
6978
if [ $? -eq 0 ]; then
7079
exit 1
7180
else
7281
echo_true
7382
fi
7483

75-
$(test curl_failure_without_redact_hook)
84+
(
85+
test curl_failure_without_redact_hook
86+
)
7687
if [ $? -eq 0 ]; then
7788
exit 1
7889
else

0 commit comments

Comments
 (0)