Compare commits
No commits in common. "49a72dc34becf2fd2b878a8f192b296108ea0905" and "19f17308b1eaac05ac525fdd31aa68b069507f3b" have entirely different histories.
49a72dc34b
...
19f17308b1
@ -45,12 +45,10 @@ 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)
|
||||
|
10
main.go
10
main.go
@ -35,15 +35,21 @@ func main() {
|
||||
// Handle termination on ctrl+signalChan
|
||||
signalChan := make(chan os.Signal, 1)
|
||||
signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
|
||||
|
||||
go func(errors chan error) {
|
||||
for {
|
||||
select {
|
||||
case <-signalChan:
|
||||
os.Exit(1)
|
||||
case err := <-errors:
|
||||
if err != nil {
|
||||
log.Printf("watcherIface.Monitor: %s\n", err)
|
||||
continue
|
||||
log.Fatalf("watcherIface.Monitor: %s\n", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}(errors)
|
||||
|
||||
// TODO: Improve this: Block main goroutine forever.
|
||||
<-make(chan struct{})
|
||||
}
|
||||
|
2
pkg/watcher/test-script.sh
Normal file
2
pkg/watcher/test-script.sh
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
echo "hello"
|
@ -1,2 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo "deploy script has been called"
|
Loading…
x
Reference in New Issue
Block a user