RunCommand executes a shell command and returns the output/error
(input string)
| 33 | |
| 34 | // RunCommand executes a shell command and returns the output/error |
| 35 | func RunCommand(input string) (string, error) { |
| 36 | args, err := shellquote.Split(input) |
| 37 | if err != nil { |
| 38 | return "", err |
| 39 | } |
| 40 | if len(args) == 0 { |
| 41 | return "", errors.New("No arguments") |
| 42 | } |
| 43 | inputCmd := args[0] |
| 44 | |
| 45 | return ExecCommand(inputCmd, args[1:]...) |
| 46 | } |
| 47 | |
| 48 | // RunBackgroundShell runs a shell command in the background |
| 49 | // It returns a function which will run the command and returns a string |
no test coverage detected