cad2d783b3
release / build-web (push) Has been cancelled
release / build-bundles (aarch64-linux-gnu-gcc, arm64, linux, ubuntu-latest, linux-arm64) (push) Has been cancelled
release / build-bundles (amd64, darwin, macos-13, macos-x64) (push) Has been cancelled
release / build-bundles (amd64, linux, ubuntu-latest, linux-x64) (push) Has been cancelled
release / build-bundles (amd64, windows, windows-latest, windows-x64) (push) Has been cancelled
release / build-bundles (arm64, darwin, macos-14, macos-arm64) (push) Has been cancelled
feat: windows support
27 lines
748 B
Go
27 lines
748 B
Go
//go:build windows
|
|
|
|
package process
|
|
|
|
import "os"
|
|
|
|
// defaultShellCommand returns the command and args for starting an interactive shell.
|
|
// On Windows, uses %COMSPEC% (typically cmd.exe) or falls back to powershell.exe.
|
|
// No -l flag since Windows shells don't use login shell mode.
|
|
func defaultShellCommand(preferredShell string) []string {
|
|
shell := preferredShell
|
|
if shell == "" {
|
|
shell = os.Getenv("COMSPEC")
|
|
}
|
|
if shell == "" {
|
|
shell = "powershell.exe"
|
|
}
|
|
return []string{shell}
|
|
}
|
|
|
|
// shellExecArgs returns the program and arguments needed to execute a command
|
|
// string through the system shell.
|
|
// On Windows: cmd /c "command"
|
|
func shellExecArgs(command string) (prog string, args []string) {
|
|
return "cmd", []string{"/c", command}
|
|
}
|