return to the same panel after switching to a subprocess

This commit is contained in:
Jesse Duffield 2019-06-08 14:01:48 +10:00
parent 71f05ff80a
commit 61a10f5cc7
3 changed files with 6 additions and 5 deletions

View file

@ -211,7 +211,6 @@ func (gui *Gui) renderLogsForTTYContainer(container *commands.Container) error {
gui.clearMainView()
command := utils.ApplyTemplate(gui.Config.UserConfig.CommandTemplates.ContainerTTYLogs, container)
gui.Log.Warn(command)
cmd := gui.OSCommand.RunCustomCommand(command)
// for some reason just saying cmd.Stdout = mainView does not work here as it does for non-tty containers, so we feed it through line by line
@ -226,7 +225,6 @@ func (gui *Gui) renderLogsForTTYContainer(container *commands.Container) error {
for s.Scan() {
// I might put a check on the stopped channel here. Would mean more code duplication though
mainView.Write(append(s.Bytes(), '\n'))
gui.Log.Warn(s.Text())
}
}()

View file

@ -222,11 +222,12 @@ func (gui *Gui) layout(g *gocui.Gui) error {
}
if gui.g.CurrentView() == nil {
if _, err := gui.g.SetCurrentView(gui.getContainersView().Name()); err != nil {
return err
v, err := gui.g.View(gui.State.PreviousView)
if err != nil {
v = gui.getServicesView()
}
if err := gui.switchFocus(gui.g, nil, gui.getServicesView()); err != nil {
if err := gui.switchFocus(gui.g, nil, v); err != nil {
return err
}
}

View file

@ -33,6 +33,8 @@ func (gui *Gui) RunWithSubprocesses() error {
}
func (gui *Gui) runCommand() error {
gui.State.PreviousView = gui.currentViewName()
gui.SubProcess.Stdout = os.Stdout
gui.SubProcess.Stderr = os.Stdout
gui.SubProcess.Stdin = os.Stdin