propagate error from sendmail v2 PROPOSED

y0ast: 1
 propagate error from sendmail

 1 files changed, 9 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/aerc/patches/13990/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH v2] propagate error from sendmail Export this patch

Currently whenever the sendmail command fails, aerc has no idea and will
happily say everything is fine and copy the email to the SENT folder.
This patch adds proper error propagation and shows an error in the ui
that something has gone wrong with the send. It also fixes the problem
with sending of the previous patch by force closing the pipe and making
sendmail send.

 commands/compose/send.go | 11 +++++++++--
 1 file 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

Merged to master, thanks!