From b4bacd641d964ab5cc90d6e94e01fefc3ce7d024 Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Thu, 30 Nov 2017 21:30:20 -0800 Subject: [PATCH] Add check for Windows ECONNRESET --- command/agent/fs_endpoint.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/command/agent/fs_endpoint.go b/command/agent/fs_endpoint.go index daf41422e8a..1c09103665c 100644 --- a/command/agent/fs_endpoint.go +++ b/command/agent/fs_endpoint.go @@ -622,13 +622,22 @@ func parseFramerErr(err error) error { return nil } - if strings.Contains(err.Error(), io.ErrClosedPipe.Error()) { + errMsg := err.Error() + + if strings.Contains(errMsg, io.ErrClosedPipe.Error()) { // The pipe check is for tests return syscall.EPIPE } // The connection was closed by our peer - if strings.Contains(err.Error(), syscall.EPIPE.Error()) || strings.Contains(err.Error(), syscall.ECONNRESET.Error()) { + if strings.Contains(errMsg, syscall.EPIPE.Error()) || strings.Contains(errMsg, syscall.ECONNRESET.Error()) { + return syscall.EPIPE + } + + // Windows version of ECONNRESET + //XXX(schmichael) I could find no existing error or constant to + // compare this against. + if strings.Contains(errMsg, "forcibly closed") { return syscall.EPIPE }