From 7e6367d88ada3429b1208c2b2245b3a2fd8daa83 Mon Sep 17 00:00:00 2001 From: Simon Maertens Date: Fri, 6 Sep 2024 00:56:34 +0200 Subject: [PATCH] Removed quarantine setup in pwsh init script on MacOS --- init/pwsh.ps1.in | 38 +++++++++++++++++---------------- testsuite/bin/install_test_pwsh | 2 +- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/init/pwsh.ps1.in b/init/pwsh.ps1.in index fb5d034e1..f6d144fdb 100644 --- a/init/pwsh.ps1.in +++ b/init/pwsh.ps1.in @@ -31,12 +31,12 @@ if ($IsWindows) { } } if ($_mlre -ne '') { - $_mlre += "`$env:__MODULES_QUARANTINE_SET=1" + $_mlre += "`$env:__MODULES_QUARANTINE_SET=1" Invoke-Expression "$_mlre" } } - $output = pwsh -Command { $_mlre & tclsh "$env:MODULES_CMD" pwsh $allargs 2>&1 } + $output = & tclsh "$env:MODULES_CMD" pwsh $allargs 2>&1 $outmsg = ($output | ? {$_.gettype().Name -ne "ErrorRecord"}) -join "`n" $errmsg = ($output | ? {$_.gettype().Name -eq "ErrorRecord"}) -join "`n" $errmsg = $errmsg.replace( @@ -52,7 +52,7 @@ if ($IsWindows) { } $mlredir = $true - if ($env:MODULES_REDIRECT_OUTPUT -ne $null) { + if ($null -ne $env:MODULES_REDIRECT_OUTPUT) { if ($env:MODULES_REDIRECT_OUTPUT -eq '0') { $mlredir = $false } @@ -125,23 +125,25 @@ if ($IsWindows) { # enable a default modulepath directory & envmodule use "$env:MODULESHOME/modulefiles" } else { - # setup quarantine if defined - if ($env:MODULES_RUN_QUARANTINE) { - $_mlre = '' - foreach ($_mlv in $env:MODULES_RUN_QUARANTINE -split ' ') { - if ($_mlv -match '^[A-Za-z_][A-Za-z0-9_]*$') { - $_mlv_value = [System.Environment]::GetEnvironmentVariable($_mlv) - if ($_mlv_value) { - $_mlre += "`$env:__MODULES_QUAR_${_mlv}='$_mlv_value';" + # setup quarantine if defined and if not on MacOS (somewhat buggy) + if (!$IsMacOS) { + if ($env:MODULES_RUN_QUARANTINE) { + $_mlre = '' + foreach ($_mlv in $env:MODULES_RUN_QUARANTINE -split ' ') { + if ($_mlv -match '^[A-Za-z_][A-Za-z0-9_]*$') { + $_mlv_value = [System.Environment]::GetEnvironmentVariable($_mlv) + if ($_mlv_value) { + $_mlre += "`$env:__MODULES_QUAR_${_mlv}='$_mlv_value';" + } + $_mlrv = "MODULES_RUNENV_$_mlv" + $_mlrv_value = [System.Environment]::GetEnvironmentVariable($_mlrv) + $_mlre += "`$env:$_mlv='$_mlrv_value';" } - $_mlrv = "MODULES_RUNENV_$_mlv" - $_mlrv_value = [System.Environment]::GetEnvironmentVariable($_mlrv) - $_mlre += "`$env:$_mlv='$_mlrv_value';" } - } - if ($_mlre -ne '') { - $_mlre += "`$env:__MODULES_QUARANTINE_SET=1;" - Invoke-Expression "$_mlre" + if ($_mlre -ne '') { + $_mlre += "`$env:__MODULES_QUARANTINE_SET=1;" + Invoke-Expression "$_mlre" + } } } diff --git a/testsuite/bin/install_test_pwsh b/testsuite/bin/install_test_pwsh index d346d44ec..3cc5310af 100755 --- a/testsuite/bin/install_test_pwsh +++ b/testsuite/bin/install_test_pwsh @@ -76,7 +76,7 @@ foreach ($cmdargs in $cmdlist.Split(':')) { $code = $LastExitCode } } - if ($ret -ne $null -and !$cmd_is_query) { + if ($null -ne $ret -and !$cmd_is_query) { Write-Output $ret } }