From 6ad648f13c196b188f9bf6e7208694fabc6902be Mon Sep 17 00:00:00 2001 From: David Paleino Date: Sun, 6 Feb 2011 18:22:14 +0100 Subject: [PATCH] Detect which flavour of ping(1) is installed This is needed because inetutils-ping does not support "-w deadline", but just waits timeout. --- wicd/wnettools.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wicd/wnettools.py b/wicd/wnettools.py index 9497933..199a863 100644 --- a/wicd/wnettools.py +++ b/wicd/wnettools.py @@ -738,7 +738,16 @@ class BaseInterface(object): trying to ping it. """ - cmd = "ping -q -w 3 -c 1 %s" % gateway + if "iputils" in misc.Run(["ping", "-V"]): + cmd = "ping -q -w 3 -c 1 %s" % gateway + else: + # ping is from inetutils-ping (which doesn't support -w) + # or from some other package + # + # If there's no AP association, this will wait for + # timeout, while the above will wait (-w) 3 seconds at + # most. + cmd = "ping -q -c 1 %s" % gateway if self.verbose: print cmd return misc.LaunchAndWait(cmd)