Skip to content

Commit

Permalink
Clean the repo that failed to initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed May 17, 2021
1 parent 39a41a3 commit 30983b1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ var daemonCmd = &cmds.Command{
return err
}
if !exist {
defer func() {
if err != nil {
log.Infof("Failed to initialize venus, cleaning up %s after attempt...", repoDir)
if err := os.RemoveAll(repoDir); err != nil {
log.Errorf("Failed to clean up failed repo: %s", err)
}
}
}()
log.Infof("Initializing repo at '%s'", repoDir)

if err := re.Emit(repoDir); err != nil {
Expand Down

0 comments on commit 30983b1

Please sign in to comment.