Remove orphaned temp files before attempting to remove directories (fixes #492)
This commit is contained in:
parent
64ffac5671
commit
0a70e0b7b6
@ -222,7 +222,7 @@ func (p *puller) run() {
|
|||||||
|
|
||||||
if changed {
|
if changed {
|
||||||
p.model.setState(p.repoCfg.ID, RepoCleaning)
|
p.model.setState(p.repoCfg.ID, RepoCleaning)
|
||||||
p.fixupDirectories()
|
p.clean()
|
||||||
changed = false
|
changed = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +261,9 @@ func (p *puller) runRO() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *puller) fixupDirectories() {
|
// clean deletes orphaned temporary files and directories that should no
|
||||||
|
// longer exist.
|
||||||
|
func (p *puller) clean() {
|
||||||
var deleteDirs []string
|
var deleteDirs []string
|
||||||
var changed = 0
|
var changed = 0
|
||||||
|
|
||||||
@ -270,6 +272,10 @@ func (p *puller) fixupDirectories() {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if info.Mode().IsRegular() && defTempNamer.IsTemporary(path) {
|
||||||
|
os.Remove(path)
|
||||||
|
}
|
||||||
|
|
||||||
if !info.IsDir() {
|
if !info.IsDir() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user