From: vsr Date: Thu, 31 Jul 2008 03:47:17 +0000 (+0000) Subject: Fix pb with killSalome script: exception is raised at os.listdir() if /tmp/logs/... X-Git-Tag: V4_1_4a1~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=44273a83dccd2a544ad2e9d0982ab265badc7f0f;p=modules%2Fkernel.git Fix pb with killSalome script: exception is raised at os.listdir() if /tmp/logs/${USER} directory does not exist. --- diff --git a/bin/killSalome.py b/bin/killSalome.py index ed9164cf5..1c76890a9 100755 --- a/bin/killSalome.py +++ b/bin/killSalome.py @@ -33,25 +33,33 @@ def killAllPorts(): dirpidict = os.path.dirname(fpidict) fpidict = os.path.basename(fpidict) fnamere = re.compile("^%s$" % fpidict) - for f in os.listdir(dirpidict): - mo = fnamere.match(f) - try: - killMyPort(mo.group(1)) - except: - pass + try: + for f in os.listdir(dirpidict): + mo = fnamere.match(f) + try: + killMyPort(mo.group(1)) + except: + pass + pass + pass + except: pass # provide compatibility with old-style pidict file (not dot-prefixed) fpidict = getPiDict('(\d*)',hidden=False) dirpidict = os.path.dirname(fpidict) fpidict = os.path.basename(fpidict) fnamere = re.compile("^%s$" % fpidict) - for f in os.listdir(dirpidict): - mo = fnamere.match(f) - try: - killMyPort(mo.group(1)) - except: - pass - pass + try: + for f in os.listdir(dirpidict): + mo = fnamere.match(f) + try: + killMyPort(mo.group(1)) + except: + pass + pass + pass + except: + pass # kill other processes if sys.platform != 'win32': import commands