msgviewer: properly close embedded terminal

The terminal widget already handles most boring stuff: unwatch terminal
events, kill the underlying process, wait for it to exit, etc. Call the
Close() method and be done with it.

This avoids issues where the embedded terminal widget is destroyed but
the pager process does not know about it and dies in agony, writing over
aerc's UI:

  Vim: Caught deadly signal HUP

Also, it may avoid leaving child processes as zombies without giving
them a proper burial.

Reported-by: skejg
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Signed-off-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Robin Jarry 2022-09-15 16:39:29 +02:00
parent c7df28d632
commit 77f69501d6
1 changed files with 3 additions and 6 deletions

View File

@ -863,12 +863,9 @@ func (pv *PartViewer) Draw(ctx *ui.Context) {
}
func (pv *PartViewer) Cleanup() {
if pv.pager != nil && pv.pager.Process != nil {
err := pv.pager.Process.Kill()
if err != nil {
logging.Warnf("failed to kill pager process: %v", err)
}
pv.pager = nil
if pv.term != nil {
pv.term.Close(nil)
pv.term = nil
}
}