1
1
Fork 0
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:
Zack Scholl 2017-10-24 07:57:32 -06:00
parent f17b0edb81
commit 0056cddc1d

View file

@ -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)
}