buildExecCommand wraps a shell command in the appropriate interpreter for the guest OS. Mirrors the logic in internal/plugins/command-runner/executor.go:buildGuestAgentCommand.
(osType, command string)
| 596 | // the guest OS. Mirrors the logic in |
| 597 | // internal/plugins/command-runner/executor.go:buildGuestAgentCommand. |
| 598 | func buildExecCommand(osType, command string) []string { |
| 599 | if isWindowsOSType(osType) { |
| 600 | return []string{ |
| 601 | "powershell.exe", |
| 602 | "-NoProfile", |
| 603 | "-NonInteractive", |
| 604 | "-ExecutionPolicy", "Bypass", |
| 605 | "-Command", command, |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | return []string{"/bin/sh", "-c", command} |
| 610 | } |
| 611 | |
| 612 | // isWindowsOSType returns true when the Proxmox ostype string indicates a |
| 613 | // Windows guest. Mirrors detectOSFamily in |
no test coverage detected