mirror of
https://github.com/go-task/task.git
synced 2025-08-10 22:42:19 +02:00
watch: ignore usually big dirs
Two items by now: - ".git" - "node_modules"
This commit is contained in:
8
watch.go
8
watch.go
@@ -9,6 +9,11 @@ import (
|
|||||||
"github.com/radovskyb/watcher"
|
"github.com/radovskyb/watcher"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var watchIgnoredDirs = []string{
|
||||||
|
".git",
|
||||||
|
"node_modules",
|
||||||
|
}
|
||||||
|
|
||||||
// watchTasks start watching the given tasks
|
// watchTasks start watching the given tasks
|
||||||
func (e *Executor) watchTasks(args ...string) error {
|
func (e *Executor) watchTasks(args ...string) error {
|
||||||
e.printfln("task: Started watching for tasks: %s", strings.Join(args, ", "))
|
e.printfln("task: Started watching for tasks: %s", strings.Join(args, ", "))
|
||||||
@@ -34,6 +39,9 @@ func (e *Executor) watchTasks(args ...string) error {
|
|||||||
w := watcher.New()
|
w := watcher.New()
|
||||||
defer w.Close()
|
defer w.Close()
|
||||||
w.SetMaxEvents(1)
|
w.SetMaxEvents(1)
|
||||||
|
if err := w.Ignore(watchIgnoredDirs...); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
|
Reference in New Issue
Block a user