Skip to content

Commit

Permalink
feat(command): support pwsh on Linux too
Browse files Browse the repository at this point in the history
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
  • Loading branch information
xgqt committed Apr 14, 2024
1 parent 9d8257c commit bae70d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Fli/Command.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@ module Command =
open System.Runtime.InteropServices
open System.Threading

let private getAvailablePwshExe () =
if RuntimeInformation.IsOSPlatform(OSPlatform.Windows) then
"pwsh.exe"
else
"pwsh"

let private shellToProcess (shell: Shells) (input: string option) =
match shell with
| CMD -> "cmd.exe", (if input.IsNone then "/c" else "/k")
| PS -> "powershell.exe", "-Command"
| PWSH -> "pwsh.exe", "-Command"
| PWSH -> getAvailablePwshExe (), "-Command"
| WSL -> "wsl.exe", "--"
| SH -> "sh", "-c"
| BASH -> "bash", "-c"
Expand Down

0 comments on commit bae70d2

Please sign in to comment.