26 lines
529 B
PowerShell
26 lines
529 B
PowerShell
[CmdletBinding()]
|
|
param(
|
|
[Parameter(ValueFromRemainingArguments = $true)]
|
|
[string[]]$Command
|
|
)
|
|
|
|
$msysRoot = if ($env:MSYS2_ROOT) { $env:MSYS2_ROOT } else { "C:\msys64" }
|
|
$bash = Join-Path $msysRoot "usr\bin\bash.exe"
|
|
|
|
if (-not (Test-Path -LiteralPath $bash)) {
|
|
Write-Error "MSYS2 bash was not found at: $bash"
|
|
exit 1
|
|
}
|
|
|
|
$env:MSYSTEM = "UCRT64"
|
|
$env:CHERE_INVOKING = "1"
|
|
|
|
if ($Command.Count -eq 0) {
|
|
& $bash --login
|
|
} else {
|
|
$cmdString = $Command -join " "
|
|
& $bash -lc $cmdString
|
|
}
|
|
|
|
exit $LASTEXITCODE
|