aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 dd7ece92..abbcb544 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
}