Restore STDIN during execute-silent

This allows users to terminate the process with CTRL-C when it hangs.
This commit is contained in:
Junegunn Choi
2018-09-27 11:10:49 +09:00
parent 8e34e6fbb4
commit 27c40dc6b0
2 changed files with 10 additions and 4 deletions

View File

@@ -1309,7 +1309,9 @@ func (t *Terminal) executeCommand(template string, forcePlus bool, background bo
t.redraw() t.redraw()
t.refresh() t.refresh()
} else { } else {
t.tui.Pause(false)
cmd.Run() cmd.Run()
t.tui.Resume(false)
} }
} }

View File

@@ -382,13 +382,17 @@ func (r *FullscreenRenderer) GetChar() Event {
return Event{Invalid, 0, nil} return Event{Invalid, 0, nil}
} }
func (r *FullscreenRenderer) Pause(bool) { func (r *FullscreenRenderer) Pause(clear bool) {
if clear {
_screen.Fini() _screen.Fini()
} }
}
func (r *FullscreenRenderer) Resume(bool) { func (r *FullscreenRenderer) Resume(clear bool) {
if clear {
r.initScreen() r.initScreen()
} }
}
func (r *FullscreenRenderer) Close() { func (r *FullscreenRenderer) Close() {
_screen.Fini() _screen.Fini()