mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
Need to close file before removing
This commit is contained in:
parent
f17b0edb81
commit
0056cddc1d
1 changed files with 1 additions and 1 deletions
2
utils.go
2
utils.go
|
@ -24,11 +24,11 @@ func CatFiles(files []string, outfile string, remove bool) error {
|
|||
if err != nil {
|
||||
return errors.Wrap(err, fmt.Sprintf("CatFiles open %v: ", file))
|
||||
}
|
||||
defer fh.Close()
|
||||
_, err = io.Copy(finished, fh)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "CatFiles copy: ")
|
||||
}
|
||||
fh.Close()
|
||||
if remove {
|
||||
os.Remove(file)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue