aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authory0ast <joost@joo.st>2020-09-20 22:53:44 +0100
committerReto Brunner <reto@labrat.space>2020-09-22 08:12:38 +0200
commit42ce6b41ff7ff56f89de25e4807ab30c6eef4662 (patch)
treead16834a08669d515972411117faf686c7e1af1f
parent8bf100f7b46bdafc83776e7c6177803a82b2eb17 (diff)
downloadaerc-42ce6b41ff7ff56f89de25e4807ab30c6eef4662.tar.gz
propagate error from sendmail
-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
}