Skip to content

Commit

Permalink
Clean the repo that failed to initialize (#4446)
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode authored Jun 1, 2021
1 parent b3a571d commit c5660c9
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 c5660c9

Please sign in to comment.