Skip to content

Commit

Permalink
Fix rename err
Browse files Browse the repository at this point in the history
Cannot change filename because the file is open (f1) and gives rename error. It must be closed before changing its name.
  • Loading branch information
omer-akbas committed May 3, 2021
1 parent 680ae89 commit f06c608
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/api/merge.go
Expand Up @@ -182,13 +182,13 @@ func MergeAppendFile(inFiles []string, outFile string, conf *pdfcpu.Configuratio
if err = f2.Close(); err != nil {
return
}
if f1 != nil {
if err = os.Rename(tmpFile, outFile); err != nil {
for _, f := range ff {
if err = f.Close(); err != nil {
return
}
}
for _, f := range ff {
if err = f.Close(); err != nil {
if f1 != nil {
if err = os.Rename(tmpFile, outFile); err != nil {
return
}
}
Expand Down

0 comments on commit f06c608

Please sign in to comment.