Skip to content

Commit 9bfb865

Browse files
Merge pull request #3223 from sebsoto/fixErrorCheck
Fix sshConnectivity close error handling
2 parents b593ed7 + 8db798e commit 9bfb865

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/windows/connectivity.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"fmt"
77
"io"
8+
"net"
89
"strings"
910
"syscall"
1011
"time"
@@ -196,7 +197,7 @@ func (c *sshConnectivity) transferFiles(sftpClient *sftp.Client, files map[strin
196197
func (c *sshConnectivity) close() error {
197198
err := c.sshClient.Close()
198199
// If the error is due to the underlying connection being already closed, don't return an error
199-
if errors.Is(syscall.EINVAL, err) {
200+
if errors.Is(err, syscall.EINVAL) || errors.Is(err, net.ErrClosed) {
200201
return nil
201202
}
202203
return err

0 commit comments

Comments
 (0)