Skip to content

Commit

Permalink
Set ErrorActionPreference=Stop on Windows on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Mar 13, 2023
1 parent 1b08836 commit 0fda8ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/scripts/tools/add_tools.ps1
Expand Up @@ -17,6 +17,7 @@ Function Edit-ComposerConfig() {
php -r "try {`$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception `$e) {exit(1);}"
if ($? -eq $False) {
Add-Log "$cross" "composer" "Could not download composer"
$ErrorActionPreference = "Stop"
exit 1;
}
New-Item -ItemType Directory -Path $composer_bin -Force > $null 2>&1
Expand Down
4 changes: 4 additions & 0 deletions src/scripts/win32.ps1
Expand Up @@ -23,6 +23,7 @@ Function Add-Log($mark, $subject, $message) {
} else {
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $mark $subject $message
if($env:fail_fast -eq 'true') {
$ErrorActionPreference = "Stop"
exit 1;
}
}
Expand Down Expand Up @@ -337,6 +338,7 @@ if ( $env:GITHUB_ACTIONS -eq 'true') {
if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
if($env:RUNNER -eq 'github') {
Add-Log $cross "Runner" "Runner set as github in self-hosted environment"
$ErrorActionPreference = "Stop"
exit 1
}
$bin_dir = 'C:\tools\bin'
Expand All @@ -348,6 +350,7 @@ if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
if($version -lt 5.6) {
Add-Log $cross "PHP" "PHP $version is not supported on self-hosted runner"
Start-Sleep 1
$ErrorActionPreference = "Stop"
exit 1
}
if ($null -eq (Get-Module -ListAvailable -Name VcRedist)) {
Expand Down Expand Up @@ -418,6 +421,7 @@ if($env:DEBUG -eq 'true') {
$installed = Get-Php -Path $php_dir
if($installed.MajorMinorVersion -ne $version) {
Add-Log $cross "PHP" "Could not setup PHP $version"
$ErrorActionPreference = "Stop"
exit 1
}
if($version -lt "5.5") {
Expand Down

0 comments on commit 0fda8ed

Please sign in to comment.