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 <dmitrymaluka@gmail.com>
This commit is contained in:
niten94 2024-06-22 21:21:13 +08:00
parent f05d3582b3
commit a84aa225ab

View File

@ -101,15 +101,18 @@ func RunInteractiveShell(input string, wait bool, getOutput bool) (string, error
c := make(chan os.Signal, 1) c := make(chan os.Signal, 1)
signal.Reset(os.Interrupt) signal.Reset(os.Interrupt)
signal.Notify(c, os.Interrupt) signal.Notify(c, os.Interrupt)
cmd.Start() err = cmd.Start()
if err == nil {
err = cmd.Wait() err = cmd.Wait()
output := outputBytes.String()
if wait { if wait {
// This is just so we don't return right away and let the user press enter to return // This is just so we don't return right away and let the user press enter to return
screen.TermMessage("") screen.TermMessage("")
} }
} else {
screen.TermMessage(err)
}
output := outputBytes.String()
// Start the screen back up // Start the screen back up
screen.TempStart(screenb) screen.TempStart(screenb)