diff options
Diffstat (limited to 'create')
-rw-r--r-- | create/content.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/create/content.go b/create/content.go index 714939f4c..b006e0f2c 100644 --- a/create/content.go +++ b/create/content.go @@ -53,6 +53,12 @@ draft: true // NewContent creates a new content file in h (or a full bundle if the archetype is a directory) // in targetPath. func NewContent(h *hugolib.HugoSites, kind, targetPath string) error { + unlock, err := h.BaseFs.LockBuild() + if err != nil { + return fmt.Errorf("failed to acquire a build lock: %s", err) + } + defer unlock() + cf := hugolib.NewContentFactory(h) if kind == "" { @@ -138,7 +144,7 @@ func (b *contentBuilder) buildDir() error { } - if err := b.h.Build(hugolib.BuildCfg{SkipRender: true, ContentInclusionFilter: contentInclusionFilter}); err != nil { + if err := b.h.Build(hugolib.BuildCfg{NoBuildLock: true, SkipRender: true, ContentInclusionFilter: contentInclusionFilter}); err != nil { return err } @@ -200,7 +206,7 @@ func (b *contentBuilder) buildFile() error { }) } - if err := b.h.Build(hugolib.BuildCfg{SkipRender: true, ContentInclusionFilter: contentInclusionFilter}); err != nil { + if err := b.h.Build(hugolib.BuildCfg{NoBuildLock: true, SkipRender: true, ContentInclusionFilter: contentInclusionFilter}); err != nil { return err } |