Ver Fonte

celeryctl: Fixes bug where -b option could not be supported

Ask Solem há 13 anos atrás
pai
commit
28a608c4bd
1 ficheiros alterados com 9 adições e 8 exclusões
  1. 9 8
      celery/bin/celeryctl.py

+ 9 - 8
celery/bin/celeryctl.py

@@ -332,15 +332,16 @@ class celeryctl(CeleryCommand):
             return self.execute("help", argv)
 
     def remove_options_at_beginning(self, argv, index=0):
-        while index <= len(argv):
-            value = argv[index]
-            if value.startswith("--"):
-                pass
-            elif value.startswith("-"):
+        if argv:
+            while index <= len(argv):
+                value = argv[index]
+                if value.startswith("--"):
+                    pass
+                elif value.startswith("-"):
+                    index += 1
+                else:
+                    return argv[index:]
                 index += 1
-            else:
-                return argv[index:]
-            index += 1
         return []
 
     def handle_argv(self, prog_name, argv):