about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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 6f8c616..9f4a009 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)