ParseCommand parses the command taking in account if the current instance uses a shell to run the commands or just calls the binary directly.
(s *settings.Settings, raw string)
| 8 | // instance uses a shell to run the commands or just calls the binary |
| 9 | // directly. |
| 10 | func ParseCommand(s *settings.Settings, raw string) (command []string, name string, err error) { |
| 11 | name, args, err := SplitCommandAndArgs(raw) |
| 12 | if err != nil { |
| 13 | return |
| 14 | } |
| 15 | |
| 16 | if len(s.Shell) == 0 || s.Shell[0] == "" { |
| 17 | command = append(command, name) |
| 18 | command = append(command, args...) |
| 19 | } else { |
| 20 | command = append(command, s.Shell...) |
| 21 | command = append(command, raw) |
| 22 | } |
| 23 | |
| 24 | return command, name, nil |
| 25 | } |
no test coverage detected