From 51440e24a7886986d74fcb94320707842adcb39c Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Wed, 9 May 2018 11:22:52 -0700 Subject: [PATCH] Keep stream and logs in sync for detecting closed pipe --- client/fs_endpoint.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/fs_endpoint.go b/client/fs_endpoint.go index 904c5cf49e8d..0578ab5195ee 100644 --- a/client/fs_endpoint.go +++ b/client/fs_endpoint.go @@ -253,7 +253,8 @@ func (f *FileSystem) stream(conn io.ReadWriteCloser) { go func() { for { if _, err := conn.Read(nil); err != nil { - if err == io.EOF { + if err == io.EOF || err == io.ErrClosedPipe { + // One end of the pipe was explicitly closed, exit cleanly cancel() return }