Skip to content

Commit a84aa22

Browse files
niten94dmaluka
andcommitted
Return error with start in RunInteractiveShell
Print and return error with process start in RunInteractiveShell if process was not able to be started. Wait until enter is pressed even if `wait` is false. Co-authored-by: Dmitry Maluka <[email protected]>
1 parent f05d358 commit a84aa22

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

internal/shell/shell.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,19 @@ func RunInteractiveShell(input string, wait bool, getOutput bool) (string, error
101101
c := make(chan os.Signal, 1)
102102
signal.Reset(os.Interrupt)
103103
signal.Notify(c, os.Interrupt)
104-
cmd.Start()
105-
err = cmd.Wait()
104+
err = cmd.Start()
105+
if err == nil {
106+
err = cmd.Wait()
107+
if wait {
108+
// This is just so we don't return right away and let the user press enter to return
109+
screen.TermMessage("")
110+
}
111+
} else {
112+
screen.TermMessage(err)
113+
}
106114

107115
output := outputBytes.String()
108116

109-
if wait {
110-
// This is just so we don't return right away and let the user press enter to return
111-
screen.TermMessage("")
112-
}
113-
114117
// Start the screen back up
115118
screen.TempStart(screenb)
116119

0 commit comments

Comments
 (0)