add writer error handler

This commit is contained in:
Dingzhu Lurong 2021-10-29 11:49:31 +08:00
parent a8cf023abc
commit 1de2f3cc7d

View File

@ -297,7 +297,10 @@ func (eic *execInContainer) Stop() {
func (eic *execInContainer) Start() error {
data, err := eic.run()
if eic.writer != nil {
eic.writer.Write(data)
// only record the write error, do not cover the command run error
if p, err := eic.writer.Write(data); err != nil {
klog.ErrorS(err, "Unable to write all bytes from execInContainer", "expectedBytes", len(data), "actualBytes", p)
}
}
return err
}