From b71f13965a2773a8bad256cafed8b631d755ba91 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Thu, 27 Aug 2020 02:30:40 +0100 Subject: [PATCH 1/2] Don't set pipefail --- CI/activate_msvc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CI/activate_msvc.sh b/CI/activate_msvc.sh index 1641f6b3e3..05925737a9 100644 --- a/CI/activate_msvc.sh +++ b/CI/activate_msvc.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -euo pipefail +set -eu if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then echo "Error: Script not sourced." From 70384d8a83bac54e14c3446a914e726061f37786 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Thu, 27 Aug 2020 03:03:03 +0100 Subject: [PATCH 2/2] Restore previous bash settings on exit --- CI/activate_msvc.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/CI/activate_msvc.sh b/CI/activate_msvc.sh index 05925737a9..47f2c246f0 100644 --- a/CI/activate_msvc.sh +++ b/CI/activate_msvc.sh @@ -1,13 +1,24 @@ #!/bin/bash +oldSettings=$- set -eu +function restoreOldSettings { + if [[ $oldSettings != *e* ]]; then + set +e + fi + if [[ $oldSettings != *u* ]]; then + set +u + fi +} + if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then echo "Error: Script not sourced." echo "You must source this script for it to work, i.e. " echo "source ./activate_msvc.sh" echo "or" echo ". ./activate_msvc.sh" + restoreOldSettings exit 1 fi @@ -78,7 +89,10 @@ command -v mt >/dev/null 2>&1 || { echo "Error: mt (MS Windows Manifest Tool) mi if [ $MISSINGTOOLS -ne 0 ]; then echo "Some build tools were unavailable after activating MSVC in the shell. It's likely that your Visual Studio $MSVC_DISPLAY_YEAR installation needs repairing." + restoreOldSettings return 1 fi -IFS="$originalIFS" \ No newline at end of file +IFS="$originalIFS" + +restoreOldSettings \ No newline at end of file