Skip to content

Commit 2836dcd

Browse files
committed
Fix: handle stream close failure
* Capture an failure to close the pod-logs stream and return to caller
1 parent 0886787 commit 2836dcd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/jobs/common_job_list.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,16 @@ func CommonJobList() []Job {
7171
buf := new(bytes.Buffer)
7272
_, err := io.Copy(buf, podLogs)
7373
if err != nil {
74+
jobResult.Error = err
7475
dc.Logger.Printf("\tCould not copy log buffer for pod %s/%s: %v\n", namespace, pod.Name, err)
7576
} else {
7677
jobResult.Files[logFileName] = buf.Bytes()
7778
}
78-
podLogs.Close()
79+
err = podLogs.Close()
80+
if err != nil {
81+
jobResult.Error = err
82+
dc.Logger.Printf("\tCould not close logs for pod %s/%s: %v\n", namespace, pod.Name, err)
83+
}
7984
}
8085
}
8186
}

0 commit comments

Comments
 (0)