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