fix(scanner/windows): support when default shell is powershell (#1844)

This commit is contained in:
MaineK00n
2024-02-02 15:42:43 +09:00
committed by GitHub
parent 7e91f5ef7e
commit b9ebcf351b
3 changed files with 158 additions and 134 deletions

View File

@@ -249,7 +249,7 @@ func sshExecExternal(c config.ServerInfo, cmdstr string, sudo bool) (result exec
var cmd *ex.Cmd
switch c.Distro.Family {
case constant.Windows:
cmd = ex.Command(sshBinaryPath, append(args, "powershell.exe", "-NoProfile", "-NonInteractive", fmt.Sprintf(`"%s`, cmdstr))...)
cmd = ex.Command(sshBinaryPath, append(args, cmdstr)...)
default:
cmd = ex.Command(sshBinaryPath, append(args, fmt.Sprintf("stty cols 1000; %s", cmdstr))...)
}