diff options
author | Vitaly Ovchinnikov <v@postbox.nz> | 2023-09-06 18:53:44 +0000 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-09-18 21:15:51 +0200 |
commit | ef7eb0ebafe8b0e132246b36edf46798879aa151 (patch) | |
tree | 05da93954706803d4e68846b582f76a59a85dc5f /worker/maildir/worker.go | |
parent | ad159d5e9bd40dd42ce2bdbcbab30d954a3c4c0a (diff) | |
download | aerc-ef7eb0ebafe8b0e132246b36edf46798879aa151.tar.gz |
maildir: log mail checking errors, if any
Add the logging of stdout/stderr of mail checking process in maildir
worker if it returns an error.
The user still sees just the exit status, but log gets a more detailed
information for further analysis.
Signed-off-by: Vitaly Ovchinnikov <v@postbox.nz>
Acked-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'worker/maildir/worker.go')
-rw-r--r-- | worker/maildir/worker.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go index de882589..620e6c17 100644 --- a/worker/maildir/worker.go +++ b/worker/maildir/worker.go @@ -927,7 +927,14 @@ func (w *Worker) handleCheckMail(msg *types.CheckMail) { ch := make(chan error) go func() { defer log.PanicHandler() - err := cmd.Run() + + _, err := cmd.Output() + if err != nil { + var exitError *exec.ExitError + if errors.As(err, &exitError) { + err = fmt.Errorf("%w\n%s", err, string(exitError.Stderr)) + } + } ch <- err }() select { |