From 77f69501d6483bf94e85cd8b9cb520c3d9175a54 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Thu, 15 Sep 2022 16:39:29 +0200 Subject: [PATCH] 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 Signed-off-by: Robin Jarry --- widgets/msgviewer.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go index 94ba98c..a74d693 100644 --- a/widgets/msgviewer.go +++ b/widgets/msgviewer.go @@ -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 } }