Skip to content

Commit

Permalink
Removed quarantine setup in pwsh init script on MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
ACSimon33 authored and xdelaruelle committed Sep 8, 2024
1 parent 0553fe3 commit 7e6367d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
38 changes: 20 additions & 18 deletions init/pwsh.ps1.in
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
}
Expand Down Expand Up @@ -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"
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion testsuite/bin/install_test_pwsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 7e6367d

Please sign in to comment.