From ab92ff0819b1cfe2abb84e4a31d2e72132d8f4bd Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Fri, 23 Feb 2018 11:30:27 -0800 Subject: [PATCH] buildscripts: Use ErrorActionPreference=stop with powershell Otherwise when an exception is thrown powershell will still exit with 0. This is similar to set -e, except exceptions wouldn't have a status code of their own. Another option would have been -ErrorAction Stop, but this need to be passed to each command inside the powershell script, so would be functionally similar to our "|| exit" style in the .bat. --- buildscripts/make_dependencies.bat | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/buildscripts/make_dependencies.bat b/buildscripts/make_dependencies.bat index 15199bf387..51557be60c 100644 --- a/buildscripts/make_dependencies.bat +++ b/buildscripts/make_dependencies.bat @@ -20,8 +20,8 @@ if not exist "%CMAKE_NAME%" ( set PATH=%PATH%;%cd%\%CMAKE_NAME%\bin :hasCmake @rem GitHub requires TLSv1.2, and for whatever reason our powershell doesn't have it enabled -powershell -command "& { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; iwr https://github.com/google/protobuf/archive/v%PROTOBUF_VER%.zip -OutFile protobuf.zip }" || exit /b 1 -powershell -command "& { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('protobuf.zip', '.') }" || exit /b 1 +powershell -command "$ErrorActionPreference = 'stop'; & { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; iwr https://github.com/google/protobuf/archive/v%PROTOBUF_VER%.zip -OutFile protobuf.zip }" || exit /b 1 +powershell -command "$ErrorActionPreference = 'stop'; & { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('protobuf.zip', '.') }" || exit /b 1 del protobuf.zip pushd protobuf-%PROTOBUF_VER%\cmake mkdir build @@ -35,7 +35,7 @@ goto :eof :installCmake -powershell -command "& { iwr https://cmake.org/files/v3.3/%CMAKE_NAME%.zip -OutFile cmake.zip }" || exit /b 1 -powershell -command "& { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('cmake.zip', '.') }" || exit /b 1 +powershell -command "$ErrorActionPreference = 'stop'; & { iwr https://cmake.org/files/v3.3/%CMAKE_NAME%.zip -OutFile cmake.zip }" || exit /b 1 +powershell -command "$ErrorActionPreference = 'stop'; & { Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('cmake.zip', '.') }" || exit /b 1 del cmake.zip goto :eof