Skip to content

Commit

Permalink
iowait example plugin should remove the socket when done
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbellamy committed Apr 12, 2016
1 parent a3c0cfd commit 3ce5b11
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/plugins/iowait/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"os"
"os/exec"
"os/signal"
"strconv"
"strings"
"time"
Expand All @@ -31,6 +32,14 @@ func main() {
}

os.Remove(*addr)
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt)
go func() {
<-interrupt
os.Remove(*addr)
os.Exit(0)
}()

listener, err := net.Listen("unix", *addr)
if err != nil {
log.Fatal(err)
Expand Down
1 change: 1 addition & 0 deletions probe/plugins/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func (r *Registry) scan() error {
}
client := &http.Client{Transport: tr, Timeout: pluginTimeout}
plugins[path] = NewPlugin(r.context, path, client, r.apiVersion, r.handshakeMetadata)
log.Infof("plugins: added plugin %s", path)
}
// remove plugins which weren't found
for path, plugin := range r.pluginsBySocket {
Expand Down

0 comments on commit 3ce5b11

Please sign in to comment.