mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-26 10:51:55 +00:00
cleanup close file error handling
This commit is contained in:
parent
0cb753e6d3
commit
d718ab6edf
1 changed files with 10 additions and 2 deletions
|
|
@ -1059,6 +1059,12 @@ func receive_loop(opts *Options, spec []string, dest string) (err error, rc int)
|
|||
}
|
||||
|
||||
err = lp.Run()
|
||||
defer func() {
|
||||
for _, f := range handler.manager.files {
|
||||
f.close()
|
||||
}
|
||||
}()
|
||||
|
||||
if err != nil {
|
||||
return err, 1
|
||||
}
|
||||
|
|
@ -1072,8 +1078,10 @@ func receive_loop(opts *Options, spec []string, dest string) (err error, rc int)
|
|||
}
|
||||
var tsf, dsz, ssz int64
|
||||
for _, f := range handler.manager.files {
|
||||
if err = f.close(); err != nil {
|
||||
return err, 1
|
||||
if rc == 0 { // no error has yet occurred report errors closing files
|
||||
if cerr := f.close(); cerr != nil {
|
||||
return cerr, 1
|
||||
}
|
||||
}
|
||||
if f.expect_diff {
|
||||
tsf += f.expected_size
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue