X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=cmd%2Fmicro%2Fshell.go;h=3e9e4acab2b9f862cd0ca98b92632d8d65f0fafd;hb=41a24e61d6b9017dbe010ae36295cb3c1dd701fc;hp=94ed95693bb1ea0ee1e46c34da10e21cad86a50f;hpb=83190a578e51ed8e1309333e2af9429fd852f37d;p=micro.git diff --git a/cmd/micro/shell.go b/cmd/micro/shell.go index 94ed9569..3e9e4aca 100644 --- a/cmd/micro/shell.go +++ b/cmd/micro/shell.go @@ -65,10 +65,10 @@ func RunBackgroundShell(input string) { }() } -func RunInteractiveShell(input string, wait bool, getOutput bool) string { +func RunInteractiveShell(input string, wait bool, getOutput bool) (string, error) { args, err := shellwords.Split(input) if err != nil { - return "" + return "", err } inputCmd := args[0] @@ -103,9 +103,6 @@ func RunInteractiveShell(input string, wait bool, getOutput bool) string { err = cmd.Wait() output := outputBytes.String() - if err != nil { - output = err.Error() - } if wait { // This is just so we don't return right away and let the user press enter to return @@ -115,7 +112,7 @@ func RunInteractiveShell(input string, wait bool, getOutput bool) string { // Start the screen back up InitScreen() - return output + return output, err } // HandleShellCommand runs the shell command @@ -126,6 +123,7 @@ func HandleShellCommand(input string, openTerm bool, waitToFinish bool) string { RunBackgroundShell(input) return "" } else { - return RunInteractiveShell(input, waitToFinish, false) + output, _ := RunInteractiveShell(input, waitToFinish, false) + return output } }