Skip to content

Commit

Permalink
feat: support read timeout not set
Browse files Browse the repository at this point in the history
  • Loading branch information
zeromake committed Jul 20, 2022
1 parent 9144482 commit ade9d70
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pkg/tty/hijack.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,11 @@ func Copy(ctx context.Context, dst net.Conn, src io.Reader, readTimeout time.Dur
nr, er := src.Read(buf)
if nr > 0 {
// docker container is stop check
err = dst.SetReadDeadline(time.Now().Add(readTimeout))
if err != nil {
break
if readTimeout > 0 {
err = dst.SetReadDeadline(time.Now().Add(readTimeout))
if err != nil {
break
}
}
nw, ew := dst.Write(buf[0:nr])
if nw < 0 || nr < nw {
Expand Down

0 comments on commit ade9d70

Please sign in to comment.