From c33ec20a463d737bf428bae1318e4627698a38fa Mon Sep 17 00:00:00 2001 From: Jesse Chen Date: Wed, 22 Jan 2025 17:38:00 -0800 Subject: [PATCH] watcher: len check lines to avoid index out of bounds --- watcher/watcher.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/watcher/watcher.go b/watcher/watcher.go index 74d9d39..b5b73a2 100644 --- a/watcher/watcher.go +++ b/watcher/watcher.go @@ -78,6 +78,9 @@ func (w *FSEventsWatcher) Run(ctx context.Context) error { scanner := bufio.NewScanner(stdout) for scanner.Scan() { line := strings.Split(scanner.Text(), " ") + if len(line) < 2 { + continue + } relFilename, err := filepath.Rel(w.directory, line[0]) if err != nil {