From 61167ce909a2099980b6cba31fbfb3590616f0e8 Mon Sep 17 00:00:00 2001 From: "oevna@users.sourceforge.net" Date: Fri, 9 Jul 2010 10:20:41 -0400 Subject: [PATCH] Unix: fixed uncaught OSError exception raised when executing ping fails. Signed-off-by: Daniel Folkinshteyn --- plugins/Unix/plugin.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/Unix/plugin.py b/plugins/Unix/plugin.py index c69644847..88f033a73 100644 --- a/plugins/Unix/plugin.py +++ b/plugins/Unix/plugin.py @@ -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