Unix: fixed uncaught OSError exception raised when executing ping fails.

Signed-off-by: Daniel Folkinshteyn <nanotube@users.sourceforge.net>
This commit is contained in:
oevna@users.sourceforge.net 2010-07-09 10:20:41 -04:00 committed by Valentin Lorentz
parent f69c47b092
commit 61167ce909

View File

@ -269,12 +269,16 @@ class Unix(callbacks.Plugin):
else:
try: host = host.group(0)
except AttributeError: pass
inst = subprocess.Popen([pingCmd,'-c','1', host],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=file(os.devnull))
try:
inst = subprocess.Popen([pingCmd,'-c','1', host],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=file(os.devnull))
except OSError, e:
irc.error('It seems the configured ping command was '
'not available (%s).' % e, Raise=True)
result = inst.communicate()
if result[1]: # stderr