Discussing in this PR shows it's dangerous to use "isUnix()" to choose the binary. Plus, there are Windows Server distributions that only have pwsh.exe. What if the plugin actually exposed two commands?
powershell 'gci .'//launches Windows PowerShell
pwsh 'gci .'//launches PowerShell Core
The only drawback I see is you won't be able to have a truly cross-platform pipeline unless you install PowerShell Core on all your Windows agents. Alternative solution: keep only one command and:
if the system is detected as Unix, use `which pwsh` and then `which powershell` to check for the correct binary
if the system is detected as Windows, use `where.exe pwsh` and then `where.exe powershell` to check for the correct binary
Discussing in this PR shows it's dangerous to use "isUnix()" to choose the binary. Plus, there are Windows Server distributions that only have pwsh.exe. What if the plugin actually exposed two commands?
The only drawback I see is you won't be able to have a truly cross-platform pipeline unless you install PowerShell Core on all your Windows agents. Alternative solution: keep only one command and:
* if the system is detected as Unix, use `which pwsh` and then `which powershell` to check for the correct binary * if the system is detected as Windows, use `where.exe pwsh.exe` and then `where.exe powershell.exe` to check for the correct binary