Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Jun 26, 2024
1 parent 3bc76ec commit f530f48
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

const DefaultWaitTimeout = 100 * time.Millisecond

// Watcher is a fsnotify watcher to watch files correctly
// Watcher is a simple fsnotify wrapper to watch updates correctly.
type Watcher struct {
watchDirect bool
watchTarget []string
Expand All @@ -29,6 +29,7 @@ type Watcher struct {

type Options struct {
// Path is the list of files or directories to watch
// It is the caller's responsibility to ensure that paths are absolute.
Path []string

// Direct is the flag to watch the file directly if file will never be removed
Expand Down Expand Up @@ -93,7 +94,7 @@ func (w *Watcher) Start() error {
}

func (w *Watcher) Close() error {
return w.watcher.Close()
return common.Close(common.PtrOrNil(w.watcher))
}

func (w *Watcher) loopUpdate() {
Expand Down

0 comments on commit f530f48

Please sign in to comment.