From b0ba38ec8133b78ae54e1440dd81e902e6fa3ff3 Mon Sep 17 00:00:00 2001 From: Harsimran Singh Maan Date: Mon, 5 Nov 2018 16:01:09 -0800 Subject: [PATCH] Create output-dir if missing Signed-off-by: Harsimran Singh Maan --- cmd/helm/template.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 63609c18c..9a1698af1 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -120,11 +120,10 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { return err } - // verify that output-dir exists if provided + // create the output-dir if it doesn't exist if t.outputDir != "" { - _, err := os.Stat(t.outputDir) - if os.IsNotExist(err) { - return fmt.Errorf("output-dir '%s' does not exist", t.outputDir) + if err := ensureDirectoryForFile(t.outputDir);err != nil { + return err } }