diff --git a/mkdir/main.go b/mkdir/main.go index a523442..8229b3c 100644 --- a/mkdir/main.go +++ b/mkdir/main.go @@ -9,8 +9,9 @@ import( func main() { var ( parentFlag, verbFlag bool - modeArg int + modeArg int ) + status := 0 flag.BoolVar(&parentFlag, "p", false, "No error if existing, make parent as needed.") flag.IntVar(&modeArg, "m", 0766, "Set file `mode`.") flag.BoolVar(&verbFlag, "v", false, "Print a message for each created directory.") @@ -33,8 +34,10 @@ func main() { } if err != nil { warn.Println(err) + status = 1 } else if verbFlag { verb.Printf("Created directory '%s'.", path) } } + os.Exit(status) }