mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-11-04 08:56:36 +07:00 
			
		
		
		
	Improve Write-Error messages
This commit is contained in:
		@ -17,7 +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"
 | 
			
		||||
    Write-Error "Error" -ErrorAction Stop
 | 
			
		||||
    Write-Error "Could not download composer" -ErrorAction Stop
 | 
			
		||||
  }
 | 
			
		||||
  New-Item -ItemType Directory -Path $composer_bin -Force > $null 2>&1
 | 
			
		||||
  if (-not(Test-Path $composer_json)) {
 | 
			
		||||
 | 
			
		||||
@ -23,7 +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') {
 | 
			
		||||
      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($env:RUNNER -eq 'github') {
 | 
			
		||||
    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'
 | 
			
		||||
  $php_dir = "$php_dir$version"
 | 
			
		||||
@ -348,7 +348,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
 | 
			
		||||
    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)) {
 | 
			
		||||
    Install-Module -Name VcRedist -Force
 | 
			
		||||
@ -418,7 +418,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"
 | 
			
		||||
  Write-Error "Error" -ErrorAction Stop
 | 
			
		||||
  Write-Error "Could not setup PHP $version" -ErrorAction Stop
 | 
			
		||||
}
 | 
			
		||||
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 }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user