mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Improve Write-Error messages
This commit is contained in:
parent
5f422817a1
commit
6461006ceb
@ -17,7 +17,7 @@ Function Edit-ComposerConfig() {
|
|||||||
php -r "try {`$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception `$e) {exit(1);}"
|
php -r "try {`$p=new Phar('$tool_path.phar', 0);exit(0);} catch(Exception `$e) {exit(1);}"
|
||||||
if ($? -eq $False) {
|
if ($? -eq $False) {
|
||||||
Add-Log "$cross" "composer" "Could not download composer"
|
Add-Log "$cross" "composer" "Could not download composer"
|
||||||
Write-Error "Error" -ErrorAction Stop
|
Write-Error "Could not download composer" -ErrorAction Stop
|
||||||
}
|
}
|
||||||
New-Item -ItemType Directory -Path $composer_bin -Force > $null 2>&1
|
New-Item -ItemType Directory -Path $composer_bin -Force > $null 2>&1
|
||||||
if (-not(Test-Path $composer_json)) {
|
if (-not(Test-Path $composer_json)) {
|
||||||
|
@ -23,7 +23,7 @@ Function Add-Log($mark, $subject, $message) {
|
|||||||
} else {
|
} else {
|
||||||
printf "\033[31;1m%s \033[0m\033[34;1m%s \033[0m\033[90;1m%s \033[0m\n" $mark $subject $message
|
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') {
|
if($env:fail_fast -eq 'true') {
|
||||||
Write-Error "Error" -ErrorAction Stop
|
Write-Error $message -ErrorAction Stop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -337,7 +337,7 @@ if ( $env:GITHUB_ACTIONS -eq 'true') {
|
|||||||
if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
|
if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
|
||||||
if($env:RUNNER -eq 'github') {
|
if($env:RUNNER -eq 'github') {
|
||||||
Add-Log $cross "Runner" "Runner set as github in self-hosted environment"
|
Add-Log $cross "Runner" "Runner set as github in self-hosted environment"
|
||||||
Write-Error "Error" -ErrorAction Stop
|
Write-Error "Runner set as github in self-hosted environment" -ErrorAction Stop
|
||||||
}
|
}
|
||||||
$bin_dir = 'C:\tools\bin'
|
$bin_dir = 'C:\tools\bin'
|
||||||
$php_dir = "$php_dir$version"
|
$php_dir = "$php_dir$version"
|
||||||
@ -348,7 +348,7 @@ if(-not($env:ImageOS) -and -not($env:ImageVersion)) {
|
|||||||
if($version -lt 5.6) {
|
if($version -lt 5.6) {
|
||||||
Add-Log $cross "PHP" "PHP $version is not supported on self-hosted runner"
|
Add-Log $cross "PHP" "PHP $version is not supported on self-hosted runner"
|
||||||
Start-Sleep 1
|
Start-Sleep 1
|
||||||
Write-Error "Error" -ErrorAction Stop
|
Write-Error "PHP $version is not supported on self-hosted runner" -ErrorAction Stop
|
||||||
}
|
}
|
||||||
if ($null -eq (Get-Module -ListAvailable -Name VcRedist)) {
|
if ($null -eq (Get-Module -ListAvailable -Name VcRedist)) {
|
||||||
Install-Module -Name VcRedist -Force
|
Install-Module -Name VcRedist -Force
|
||||||
@ -418,7 +418,7 @@ if($env:DEBUG -eq 'true') {
|
|||||||
$installed = Get-Php -Path $php_dir
|
$installed = Get-Php -Path $php_dir
|
||||||
if($installed.MajorMinorVersion -ne $version) {
|
if($installed.MajorMinorVersion -ne $version) {
|
||||||
Add-Log $cross "PHP" "Could not setup PHP $version"
|
Add-Log $cross "PHP" "Could not setup PHP $version"
|
||||||
Write-Error "Error" -ErrorAction Stop
|
Write-Error "Could not setup PHP $version" -ErrorAction Stop
|
||||||
}
|
}
|
||||||
if($version -lt "5.5") {
|
if($version -lt "5.5") {
|
||||||
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Get-File -Url "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
|
('libeay32.dll', 'ssleay32.dll') | ForEach-Object -Parallel { Get-File -Url "$using:php_builder/releases/download/openssl-1.0.2u/$_" -OutFile $using:php_dir\$_ >$null 2>&1 }
|
||||||
|
Loading…
Reference in New Issue
Block a user