Fixed command runner calls with shell

pull/3676/head
BeziCZ 2025-01-24 10:11:37 +01:00
parent fd92101159
commit 232e617844
1 changed files with 14 additions and 2 deletions

View File

@ -8,7 +8,7 @@ import (
// ParseCommand parses the command taking in account if the current
// instance uses a shell to run the commands or just calls the binary
// directyly.
// directly.
func ParseCommand(s *settings.Settings, raw string) ([]string, error) {
var command []string
@ -26,7 +26,19 @@ func ParseCommand(s *settings.Settings, raw string) ([]string, error) {
command = append(command, cmd)
command = append(command, args...)
} else {
command = append(s.Shell, raw) //nolint:gocritic
cmd, args, err := SplitCommandAndArgs(s.Shell[0])
if err != nil {
return nil, err
}
_, err = exec.LookPath(cmd)
if err != nil {
return nil, err
}
command = append(command, cmd)
command = append(command, args...)
command = append(command, raw)
}
return command, nil