[distribution] Handle missing instance directory when listing and running instance command. stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Fri, 15 Oct 2010 11:40:36 +0200
branchstable
changeset 6505 ac4cecb26813
parent 6504 88b3172eb7c7
child 6506 c1661ea815dc
[distribution] Handle missing instance directory when listing and running instance command. no directory means no available instance.
cwctl.py
--- a/cwctl.py	Fri Oct 15 11:39:54 2010 +0200
+++ b/cwctl.py	Fri Oct 15 11:40:36 2010 +0200
@@ -63,7 +63,10 @@
         raise ExecutionError('can\'t kill process %s' % pid)
 
 def list_instances(regdir):
-    return sorted(idir for idir in listdir(regdir) if isdir(join(regdir, idir)))
+    if isdir(regdir):
+        return sorted(idir for idir in listdir(regdir) if isdir(join(regdir, idir)))
+    else:
+        return []
 
 def detect_available_modes(templdir):
     modes = []