mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-18 12:59:31 +00:00
iowait example plugin should remove the socket when done
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user