diff options
author | y0ast <joost@joo.st> | 2020-09-20 22:53:44 +0100 |
---|---|---|
committer | Reto Brunner <reto@labrat.space> | 2020-09-22 08:12:38 +0200 |
commit | 42ce6b41ff7ff56f89de25e4807ab30c6eef4662 (patch) | |
tree | ad16834a08669d515972411117faf686c7e1af1f /commands/compose | |
parent | 8bf100f7b46bdafc83776e7c6177803a82b2eb17 (diff) | |
download | aerc-42ce6b41ff7ff56f89de25e4807ab30c6eef4662.tar.gz |
propagate error from sendmail
Diffstat (limited to 'commands/compose')
-rw-r--r-- | commands/compose/send.go | 11 |
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 } |