From 49a72dc34becf2fd2b878a8f192b296108ea0905 Mon Sep 17 00:00:00 2001 From: Urko Date: Sun, 26 Feb 2023 16:26:13 +0100 Subject: [PATCH] feat: log event --- internal/watcher/watcher.go | 2 ++ test-script.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/watcher/watcher.go b/internal/watcher/watcher.go index 77e03a9..33f5cf0 100644 --- a/internal/watcher/watcher.go +++ b/internal/watcher/watcher.go @@ -45,10 +45,12 @@ func (w *watcher) Listen(binaryPath, scriptPath string, outputErr chan<- error) outputErr <- errEventsClosedChan return } + if !event.Has(fsnotify.Write) { log.Printf("is not Write: %s\n", event.Name) continue } + log.Printf("event: %s | op: %s \n", event.Name, event.Op) if err := w.deploy(binaryPath, scriptPath); err != nil { log.Printf("deploy: %s\n", err) diff --git a/test-script.sh b/test-script.sh index 57ac3b2..b4110f4 100644 --- a/test-script.sh +++ b/test-script.sh @@ -1,2 +1,2 @@ #!/bin/bash -echo "hello" \ No newline at end of file +echo "deploy script has been called" \ No newline at end of file