From c09954033f01438325ff0f94d92881d3ebdc9f55 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Sun, 7 Jun 2020 02:41:28 +0530 Subject: [PATCH] Fix exit log on self-hosted --- src/scripts/darwin.sh | 11 ++++++----- src/scripts/linux.sh | 16 +++++++++------- src/scripts/win32.ps1 | 2 +- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/scripts/darwin.sh b/src/scripts/darwin.sh index 7069d6b2..4e7a845c 100644 --- a/src/scripts/darwin.sh +++ b/src/scripts/darwin.sh @@ -26,10 +26,6 @@ read_env() { # Function to setup environment for self-hosted runners. self_hosted_setup() { - if [[ "$version" =~ $old_versions ]]; then - add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner" - exit 1 - fi if [[ $(command -v brew) == "" ]]; then step_log "Setup Brew" curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash -s >/dev/null 2>&1 @@ -238,7 +234,12 @@ existing_version=$(php-config --version 2>/dev/null | cut -c 1-3) read_env if [ "$runner" = "self-hosted" ]; then - self_hosted_setup >/dev/null 2>&1 + if [[ "$version" =~ $old_versions ]]; then + add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner" + exit 1 + else + self_hosted_setup >/dev/null 2>&1 + fi fi # Setup PHP diff --git a/src/scripts/linux.sh b/src/scripts/linux.sh index 294ea2f9..793f9833 100644 --- a/src/scripts/linux.sh +++ b/src/scripts/linux.sh @@ -34,10 +34,6 @@ update_lists() { # Function to setup environment for self-hosted runners. self_hosted_setup() { - if [[ "$version" =~ $old_versions ]]; then - add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner" - exit 1 - fi echo "Set disable_coredump false" | sudo tee -a /etc/sudo.conf if ! command -v apt-fast >/dev/null; then sudo ln -sf /usr/bin/apt-get /usr/bin/apt-fast @@ -367,12 +363,18 @@ apt_install="sudo $debconf_fix apt-fast install -y" tool_path_dir="/usr/local/bin" existing_version=$(php-config --version 2>/dev/null | cut -c 1-3) -# Setup PHP -step_log "Setup PHP" read_env if [ "$runner" = "self-hosted" ]; then - self_hosted_setup >/dev/null 2>&1 + if [[ "$version" =~ $old_versions ]]; then + add_log "$cross" "PHP" "PHP $version is not supported on self-hosted runner" + exit 1 + else + self_hosted_setup >/dev/null 2>&1 + fi fi + +# Setup PHP +step_log "Setup PHP" sudo mkdir -p /var/run /run/php if [ "$existing_version" != "$version" ]; then if [ ! -e "/usr/bin/php$version" ]; then diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index b35c8894..fe0982b3 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -308,7 +308,7 @@ if($env:RUNNER -eq 'self-hosted') { } if($version -lt 5.6) { Add-Log $cross "PHP" "PHP $version is not supported on self-hosted runner" - Start-Sleep 3 + Start-Sleep 1 exit 1 } if ((Get-InstalledModule).Name -notcontains 'VcRedist') {