From a3a7a198702910afeac0bc2b8367bbd658167c4a Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Fri, 3 Jul 2015 14:28:18 +0100 Subject: [PATCH] simplifying refactor --- prog/weavewait/main.go | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/prog/weavewait/main.go b/prog/weavewait/main.go index 0acd5f74..9b1151bf 100644 --- a/prog/weavewait/main.go +++ b/prog/weavewait/main.go @@ -2,12 +2,10 @@ package main import ( "fmt" - "math" "os" "os/exec" "os/signal" "syscall" - "time" "github.com/weaveworks/weave/net" ) @@ -16,20 +14,16 @@ func main() { if len(os.Args) <= 1 { os.Exit(0) } - args := os.Args[1:] - signalWait := time.Duration(math.MaxInt64) + if args[0] == "-s" { - signalWait = 0 args = args[1:] + } else { + usr2 := make(chan os.Signal) + signal.Notify(usr2, syscall.SIGUSR2) + <-usr2 } - usr2 := make(chan os.Signal) - signal.Notify(usr2, syscall.SIGUSR2) - select { - case <-usr2: - case <-time.After(signalWait): - } _, err := net.EnsureInterface("ethwe", -1) checkErr(err)