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
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
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.refresh()
} else {
t.tui.Pause(false)
cmd.Run()
t.tui.Resume(false)
}
}

View File

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