about summary refs log tree commit diff stats
path: root/commands/compose/send.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/compose/send.go')
-rw-r--r--commands/compose/send.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/commands/compose/send.go b/commands/compose/send.go
index dd7ece9..abbcb54 100644
--- a/commands/compose/send.go
+++ b/commands/compose/send.go
@@ -231,10 +231,17 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error {
 		if err != nil {
 			return 0, errors.Wrap(err, "cmd.StdinPipe")
 		}
-		defer wc.Close()
-		go cmd.Run()
+		err = cmd.Start()
+		if err != nil {
+			return 0, errors.Wrap(err, "cmd.Start")
+		}
 		ctr := datacounter.NewWriterCounter(wc)
 		composer.WriteMessage(header, ctr)
+		wc.Close() // force close to make sendmail send
+		err = cmd.Wait()
+		if err != nil {
+			return 0, errors.Wrap(err, "cmd.Wait")
+		}
 		return int(ctr.Count()), nil
 	}