Skip to content

Commit

Permalink
Skip failing for undefined variables in MacOS (apache#15744)
Browse files Browse the repository at this point in the history
Failing with undefined variables is a good technique to avoid
typos in Bash, but for MacOS this is problematic as bash
used by default on MacOS fails with undefined variable
when there is an empty array passed - which is often needed,
for example when you pass "${@}" arguments.

This PR disables undefined variable check for MacOS.
  • Loading branch information
potiuk authored May 9, 2021
1 parent d627dfa commit 507bca5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/ci/libraries/_script_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@
# specific language governing permissions and limitations
# under the License.

set -euo pipefail
set -eo pipefail

if [[ $(uname -s) != "Darwin" ]]; then
# do not fail with undefined variable on MacOS. The old Bash which is default on Mac OS
# fails with undefined variable when you are passing an empty variable and this causes
# problems for example when you try to pass empty list of arguments "${@}"
set -u
fi

export AIRFLOW_SOURCES="${AIRFLOW_SOURCES:=$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../.." && pwd )}"
readonly AIRFLOW_SOURCES
Expand Down

0 comments on commit 507bca5

Please sign in to comment.