aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-07-08 18:50:40 -0400
committerDrew DeVault <sir@cmpwn.com>2019-07-08 18:50:40 -0400
commit3f30c27bb31f26ca639b7a87d54a7c522bbe8be0 (patch)
tree3564465d137623f502dd256f0b6565eac02ccdad /commands
parent133085b436f56bdd48fb1aba1184811b3a278d3c (diff)
downloadaerc-3f30c27bb31f26ca639b7a87d54a7c522bbe8be0.tar.gz
Fix :pipe -b actually writing to stdin
Diffstat (limited to 'commands')
-rw-r--r--commands/msg/pipe.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go
index 6f8c6167..9f4a0099 100644
--- a/commands/msg/pipe.go
+++ b/commands/msg/pipe.go
@@ -86,7 +86,15 @@ func (_ Pipe) Execute(aerc *widgets.Aerc, args []string) error {
doExec := func(reader io.Reader) {
ecmd := exec.Command(cmd[0], cmd[1:]...)
- err := ecmd.Run()
+ pipe, err := ecmd.StdinPipe()
+ if err != nil {
+ return
+ }
+ go func() {
+ defer pipe.Close()
+ io.Copy(pipe, reader)
+ }()
+ err = ecmd.Run()
if err != nil {
aerc.PushStatus(" "+err.Error(), 10*time.Second).
Color(tcell.ColorDefault, tcell.ColorRed)