diff options
author | Martin Polden <mpolden@mpolden.no> | 2021-09-12 10:16:00 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2021-09-12 10:16:40 +0200 |
commit | 96cdd967f054fb8bbc9575ecebbef2cc5a68a14f (patch) | |
tree | d1915b22d699c8cdeff37eed3313599a9f0608ce | |
parent | cfb4e7e874e16491683b48f5ec7e56093a0680bd (diff) |
watcher: Use platform-specific flags on Linux
-rw-r--r-- | watcher/watcher.go | 2 | ||||
-rw-r--r-- | watcher/watcher_linux.go | 8 | ||||
-rw-r--r-- | watcher/watcher_notlinux.go | 7 |
3 files changed, 15 insertions, 2 deletions
diff --git a/watcher/watcher.go b/watcher/watcher.go index 8f837e1..93e4f33 100644 --- a/watcher/watcher.go +++ b/watcher/watcher.go @@ -15,8 +15,6 @@ import ( "github.com/rjeczalik/notify" ) -const notifyFlag = notify.Write | notify.Rename - type Handler interface { Handle(filename, postCommand string, remove bool) error } diff --git a/watcher/watcher_linux.go b/watcher/watcher_linux.go new file mode 100644 index 0000000..a7a23cd --- /dev/null +++ b/watcher/watcher_linux.go @@ -0,0 +1,8 @@ +//go:build linux + +package watcher + +import "github.com/rjeczalik/notify" + +// Watch IN_CLOSE_WRITE events on Linux to reduce the number of events to process +const notifyFlag = notify.InCloseWrite | notify.InMovedFrom diff --git a/watcher/watcher_notlinux.go b/watcher/watcher_notlinux.go new file mode 100644 index 0000000..efd7ea8 --- /dev/null +++ b/watcher/watcher_notlinux.go @@ -0,0 +1,7 @@ +//go:build !linux + +package watcher + +import "github.com/rjeczalik/notify" + +const notifyFlag = notify.Write | notify.Rename |