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