From 3f30c27bb31f26ca639b7a87d54a7c522bbe8be0 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 8 Jul 2019 18:50:40 -0400 Subject: Fix :pipe -b actually writing to stdin --- commands/msg/pipe.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'commands/msg') 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) -- cgit 1.4.1-2-gfad0