]> git.lizzy.rs Git - micro.git/blobdiff - cmd/micro/shell.go
Merge pull request #1135 from whilei/gofmt-2018-Jun-17-00-39
[micro.git] / cmd / micro / shell.go
index 94ed95693bb1ea0ee1e46c34da10e21cad86a50f..3e9e4acab2b9f862cd0ca98b92632d8d65f0fafd 100644 (file)
@@ -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
        }
 }