Skip to content

Commit

Permalink
fix: handlers used to work after "exec sh" command
Browse files Browse the repository at this point in the history
feature: hot key for "exec sh"
  • Loading branch information
fr05t1k committed Oct 12, 2018
1 parent f27de1c commit e68f7ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions grid.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ func Display() bool {
menu = LogMenu
ui.StopLoop()
})
ui.Handle("/sys/kbd/e", func(ui.Event) {
menu = ExecSh
ui.StopLoop()
})
ui.Handle("/sys/kbd/o", func(ui.Event) {
menu = SingleView
ui.StopLoop()
Expand Down
6 changes: 6 additions & 0 deletions menus.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var helpDialog = []menu.Item{
{"[r] - reverse container sort order", ""},
{"[o] - open single view", ""},
{"[l] - view container logs ([t] to toggle timestamp when open)", ""},
{"[e] - exec sh", ""},
{"[S] - save current configuration to file", ""},
{"[q] - exit ctop", ""},
}
Expand Down Expand Up @@ -219,6 +220,11 @@ func ExecSh() MenuFn {
return nil
}

ui.DefaultEvtStream.ResetHandlers()
defer ui.DefaultEvtStream.ResetHandlers()
ui.StopLoop()
defer ui.Loop()

// Reset colors && clear screen && run sh
cmdName := fmt.Sprintf("echo '\033[0m' && clear && docker exec -it %s sh", c.GetMeta("name"))
cmd := exec.Command("bash", "-c", cmdName)
Expand Down

0 comments on commit e68f7ba

Please sign in to comment.