mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-19 14:57:04 +00:00
Remove unreachable code, and don't leak contexts
This patch performs some minor cleanups for things detected by "go vet": - Remove one line of unreachable code. - Don't leak contexts until their deadline expires, cancel them.
This commit is contained in:
@@ -386,8 +386,9 @@ func (item *Item) deliver(q *Queue, rcpt *Recipient) (err error, permanent bool)
|
||||
if len(c) == 0 {
|
||||
return fmt.Errorf("empty pipe"), true
|
||||
}
|
||||
ctx, _ := context.WithDeadline(context.Background(),
|
||||
ctx, cancel := context.WithDeadline(context.Background(),
|
||||
time.Now().Add(30*time.Second))
|
||||
defer cancel()
|
||||
cmd := exec.CommandContext(ctx, c[0], c[1:]...)
|
||||
cmd.Stdin = bytes.NewReader(item.Data)
|
||||
return cmd.Run(), true
|
||||
|
||||
Reference in New Issue
Block a user