aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitaly Ovchinnikov <v@postbox.nz>2023-09-06 18:53:44 +0000
committerRobin Jarry <robin@jarry.cc>2023-09-18 21:15:51 +0200
commitef7eb0ebafe8b0e132246b36edf46798879aa151 (patch)
tree05da93954706803d4e68846b582f76a59a85dc5f
parentad159d5e9bd40dd42ce2bdbcbab30d954a3c4c0a (diff)
downloadaerc-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>
-rw-r--r--worker/maildir/worker.go9
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 {