Ensure cache dir is always available in RunLogCache

This commit is contained in:
William Martin 2024-04-05 15:39:33 +02:00
parent 103586a94c
commit c2aee1e402

View file

@ -46,6 +46,10 @@ func (c RunLogCache) Exists(key string) (bool, error) {
}
func (c RunLogCache) Create(key string, content io.Reader) error {
if err := os.MkdirAll(filepath.Dir(c.cacheDir), 0755); err != nil {
return fmt.Errorf("creating cache directory: %v", err)
}
out, err := os.Create(c.filepath(key))
if err != nil {
return fmt.Errorf("creating cache entry: %v", err)