Skip to content

Commit

Permalink
cleanup created bundle when creating failed
Browse files Browse the repository at this point in the history
Signed-off-by: Ma Shimiao <[email protected]>
  • Loading branch information
Ma Shimiao committed Aug 22, 2017
1 parent 50ad08a commit 5e6f503
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions image/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,13 @@ func createBundle(w walker, m *manifest, dest, rootfs string) error {
if err2 := os.MkdirAll(dest, 0755); err2 != nil {
return err2
}
defer func() {
if err != nil {
if err3 := os.RemoveAll(dest); err3 != nil {
fmt.Printf("Failed to clean up %q: %s\n", dest, err3.Error())
}
}
}()
} else {
return err
}
Expand Down

0 comments on commit 5e6f503

Please sign in to comment.