Skip to content

Commit

Permalink
Handle os.Mkdir error
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryTsepelev committed Apr 26, 2021
1 parent c5dcd9c commit 9c9ae6d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,12 @@ func DeleteGitHooks(fs afero.Fs) {

hooks, err := afero.ReadDir(fs, hooksPath)
if (err != nil) {
log.Println(".git/hooks directory does not exist, creating")
os.Mkdir(hooksPath, os.ModePerm)
log.Println("⚠️ ", au.Bold(".git/hooks"), "directory does not exist, creating")

if err := os.Mkdir(hooksPath, os.ModePerm); err != nil {
log.Println(au.Brown("🚨 Failed to create"), au.Bold(".git/hooks"), au.Brown("directory"))
log.Fatal(err)
}
}

for _, file := range hooks {
Expand Down

0 comments on commit 9c9ae6d

Please sign in to comment.