msgviewer: copy stderr into pager
This prevents a broken filter config from being a silent error
This commit is contained in:
parent
d30a6e3d1f
commit
3cf6c82633
|
@ -386,15 +386,31 @@ func (pv *PartViewer) attemptCopy() {
|
||||||
header.SetText("Content-Description", pv.part.Description)
|
header.SetText("Content-Description", pv.part.Description)
|
||||||
if pv.filter != nil {
|
if pv.filter != nil {
|
||||||
stdout, _ := pv.filter.StdoutPipe()
|
stdout, _ := pv.filter.StdoutPipe()
|
||||||
|
stderr, _ := pv.filter.StderrPipe()
|
||||||
pv.filter.Start()
|
pv.filter.Start()
|
||||||
|
ch := make(chan interface{})
|
||||||
go func() {
|
go func() {
|
||||||
_, err := io.Copy(pv.pagerin, stdout)
|
_, err := io.Copy(pv.pagerin, stdout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pv.err = err
|
pv.err = err
|
||||||
pv.Invalidate()
|
pv.Invalidate()
|
||||||
}
|
}
|
||||||
pv.pagerin.Close()
|
|
||||||
stdout.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() {
|
go func() {
|
||||||
|
|
Loading…
Reference in New Issue