~sircmpwn/aerc

3cf6c82633fb153663e7927e20818f355d949a89 — Drew DeVault 1 year, 1 month ago d30a6e3
msgviewer: copy stderr into pager

This prevents a broken filter config from being a silent error
1 files changed, 17 insertions(+), 1 deletions(-)

M widgets/msgviewer.go
M widgets/msgviewer.go => widgets/msgviewer.go +17 -1
@@ 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() {