From 0cbb8be7f78e6a2109cc568d2c30cdb6b5f3f63b Mon Sep 17 00:00:00 2001 From: jienfak Date: Sat, 28 Sep 2019 18:03:39 +0500 Subject: [PATCH] mkdir: Return status added. --- mkdir/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) }