Skip to content

Commit

Permalink
feat(worker): add ctx err to log on cmd error
Browse files Browse the repository at this point in the history
  • Loading branch information
nevivurn committed Oct 3, 2024
1 parent e74cf59 commit 8a7b991
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"log"
"os/exec"
Expand Down Expand Up @@ -76,7 +77,9 @@ func CmdWorker(command string) WorkerFunc {
cmd.Stdin = bytes.NewReader(b)
out, err := cmd.CombinedOutput()
if err != nil {
return fmt.Errorf("cmd worker: %v; %v", err, string(out))
return errors.Join(
fmt.Errorf("cmd worker: %v; %v", err, string(out)),
ctx.Err())
}
log.Println(string(out))

Expand Down

0 comments on commit 8a7b991

Please sign in to comment.