Skip to content

Commit

Permalink
fix: watch modules lock broke if no .ftl dir (#4047)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt2e authored Jan 15, 2025
1 parent 35df745 commit 9139877
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/watch/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package watch
import (
"context"
"fmt"
"os"
"path/filepath"
"strings"
"sync"
Expand Down Expand Up @@ -131,8 +132,12 @@ func (w *Watcher) Watch(ctx context.Context, period time.Duration, moduleDirs []
}

var flockRelease func() error

if path, ok := w.lockPath.Get(); ok {
var err error
err := os.Mkdir(filepath.Dir(path), 0700)
if err != nil && !os.IsExist(err) {
logger.Debugf("error creating lock directory: %v", err)
}
flockRelease, err = flock.Acquire(ctx, path, period)
if err != nil {
logger.Debugf("error acquiring modules lock to discover modules: %v", err)
Expand Down

0 comments on commit 9139877

Please sign in to comment.