Skip to content

Commit

Permalink
Close files
Browse files Browse the repository at this point in the history
  • Loading branch information
jjjordanmsft committed Feb 11, 2018
1 parent 9ef9ec9 commit b3b7705
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ func (sesh *SSHSession) sendFiles(dir string, files []string) error {

info, err := f.Stat()
if err != nil {
f.Close()
log.Printf("Failed to stat %s: %s", file, err.Error())
result <- err
return
Expand All @@ -301,6 +302,7 @@ func (sesh *SSHSession) sendFiles(dir string, files []string) error {
fmt.Fprintf(stdin, "C%04o %d %s\n", info.Mode().Perm(), info.Size(), path.Base(file))
io.Copy(stdin, f)
fmt.Fprintf(stdin, "\x00")
f.Close()
}

result <- nil
Expand Down

0 comments on commit b3b7705

Please sign in to comment.