Merge pull request #452 from sharifelgamal/cache-fix

Create cache directory if it doesn't already exist
This commit is contained in:
Sharif Elgamal
2019-08-02 13:41:38 -07:00
committed by GitHub
3 changed files with 9 additions and 2 deletions
+6
View File
@@ -52,6 +52,12 @@ var RootCmd = &cobra.Command{
return nil
},
Run: func(cmd *cobra.Command, args []string) {
if _, err := os.Stat(opts.CacheDir); os.IsNotExist(err) {
err = os.MkdirAll(opts.CacheDir, 0755)
if err != nil {
exit(errors.Wrap(err, "Failed to create cache directory"))
}
}
if err := cache.WarmCache(opts); err != nil {
exit(errors.Wrap(err, "Failed warming cache"))
}