Skip to content

Commit 5fd44f9

Browse files
committed
fix(extractor): fix deletion of cloned repo
The git files channel was closed before deleting concerned git repo. This resulted in eventChannel being empty and stopping the program before the last cloned repo could have been deleted.
1 parent 0baa997 commit 5fd44f9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cloner/cloner.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ func NewDiskCloner(baseDir string) *DiskCloner {
3535

3636
return diskCloner
3737
}
38+
39+
log.Warnln("Clone directory provided does not exist. Will clone in default cache directory.")
3840
}
3941

4042
if cacheDir, err := os.UserCacheDir(); err == nil {

extractor.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,14 @@ func (fe *FastExtractor) Run(path string, after string) chan *GitFile {
8585
fe.ChanGitFiles <- &gitFile
8686
}
8787

88-
close(fe.ChanGitFiles)
89-
log.Infof("finishing iterating over files, we have collected %d files\n", num)
88+
log.Infof("finished iterating over files, we have collected %d files\n", num)
9089

9190
if err := os.RemoveAll(path); err != nil {
9291
log.Errorln("Unable to remove directory ", path)
9392
}
93+
94+
log.Infof("Correctly removed cloned directory %s", path)
95+
close(fe.ChanGitFiles)
9496
}()
9597

9698
return fe.ChanGitFiles

0 commit comments

Comments
 (0)