Improve shell commands
This commit is contained in:
parent
4f41881c10
commit
0a49ea0a0d
3 changed files with 5 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// +build linux darwin dragonfly solaris openbsd netbsd freebsd
|
||||
// +build linux darwin dragonfly openbsd freebsd
|
||||
|
||||
package main
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// +build plan9 nacl windows
|
||||
// +build !linux,!darwin,!freebsd,!dragonfly,!openbsd
|
||||
|
||||
package main
|
||||
|
Loading…
Reference in a new issue