about summary refs log tree commit diff stats
path: root/widgets
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-05-26 11:18:51 -0400
committerDrew DeVault <sir@cmpwn.com>2019-05-26 11:18:51 -0400
commit3cf6c82633fb153663e7927e20818f355d949a89 (patch)
tree8d7e429ddbd3cc74d18cf1c4762085aee88ac69e /widgets
parentd30a6e3d1f1cf035d018ec27145ef57c4ce41606 (diff)
downloadaerc-3cf6c82633fb153663e7927e20818f355d949a89.tar.gz
msgviewer: copy stderr into pager
This prevents a broken filter config from being a silent error
Diffstat (limited to 'widgets')
-rw-r--r--widgets/msgviewer.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index 39ee637..e0fe6aa 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -386,15 +386,31 @@ func (pv *PartViewer) attemptCopy() {
 		header.SetText("Content-Description", pv.part.Description)
 		if pv.filter != nil {
 			stdout, _ := pv.filter.StdoutPipe()
+			stderr, _ := pv.filter.StderrPipe()
 			pv.filter.Start()
+			ch := make(chan interface{})
 			go func() {
 				_, err := io.Copy(pv.pagerin, stdout)
 				if err != nil {
 					pv.err = err
 					pv.Invalidate()
 				}
-				pv.pagerin.Close()
 				stdout.Close()
+				ch <- nil
+			}()
+			go func() {
+				_, err := io.Copy(pv.pagerin, stderr)
+				if err != nil {
+					pv.err = err
+					pv.Invalidate()
+				}
+				stderr.Close()
+				ch <- nil
+			}()
+			go func() {
+				<-ch
+				<-ch
+				pv.pagerin.Close()
 			}()
 		}
 		go func() {