Compare commits
2 Commits
19f17308b1
...
49a72dc34b
Author | SHA1 | Date |
---|---|---|
Urko | 49a72dc34b | |
Urko | a67ef6f2d8 |
|
@ -45,10 +45,12 @@ func (w *watcher) Listen(binaryPath, scriptPath string, outputErr chan<- error)
|
||||||
outputErr <- errEventsClosedChan
|
outputErr <- errEventsClosedChan
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !event.Has(fsnotify.Write) {
|
if !event.Has(fsnotify.Write) {
|
||||||
log.Printf("is not Write: %s\n", event.Name)
|
log.Printf("is not Write: %s\n", event.Name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
log.Printf("event: %s | op: %s \n", event.Name, event.Op)
|
||||||
|
|
||||||
if err := w.deploy(binaryPath, scriptPath); err != nil {
|
if err := w.deploy(binaryPath, scriptPath); err != nil {
|
||||||
log.Printf("deploy: %s\n", err)
|
log.Printf("deploy: %s\n", err)
|
||||||
|
|
24
main.go
24
main.go
|
@ -35,21 +35,15 @@ func main() {
|
||||||
// Handle termination on ctrl+signalChan
|
// Handle termination on ctrl+signalChan
|
||||||
signalChan := make(chan os.Signal, 1)
|
signalChan := make(chan os.Signal, 1)
|
||||||
signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
|
signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM)
|
||||||
|
for {
|
||||||
go func(errors chan error) {
|
select {
|
||||||
for {
|
case <-signalChan:
|
||||||
select {
|
os.Exit(1)
|
||||||
case <-signalChan:
|
case err := <-errors:
|
||||||
os.Exit(1)
|
if err != nil {
|
||||||
case err := <-errors:
|
log.Printf("watcherIface.Monitor: %s\n", err)
|
||||||
if err != nil {
|
continue
|
||||||
log.Fatalf("watcherIface.Monitor: %s\n", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}(errors)
|
}
|
||||||
|
|
||||||
// TODO: Improve this: Block main goroutine forever.
|
|
||||||
<-make(chan struct{})
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
echo "hello"
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/bash
|
||||||
|
echo "deploy script has been called"
|
Loading…
Reference in New Issue