DetectShell returns the appropriate shell binary and its argument prefix for the current platform. On Windows, it prefers PowerShell (pwsh.exe or powershell.exe) resolved via exec.LookPath (which returns an absolute path on success), falling back to cmd.exe resolved through [WindowsCmdExe]. On Uni
()
| 38 | // |
| 39 | // On Unix, it uses the SHELL environment variable or /bin/sh. |
| 40 | func DetectShell() (shell string, argsPrefix []string) { |
| 41 | if runtime.GOOS == "windows" { |
| 42 | return DetectWindowsShell() |
| 43 | } |
| 44 | |
| 45 | return defaultUnixShell(), []string{"-c"} |
| 46 | } |
| 47 | |
| 48 | // DetectWindowsShell returns the shell binary and argument prefix for Windows. |
| 49 | // It prefers PowerShell (resolved via LookPath, which returns an absolute path), |