mirror of https://github.com/grpc/grpc-java.git
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.
This commit is contained in:
parent
4bd4cf4ec1
commit
ab92ff0819
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue