瀏覽代碼

Commands: Don't load config when printing --version. Closes #347. Thanks to nairbv

Ask Solem 14 年之前
父節點
當前提交
3516627969
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      celery/bin/base.py

+ 5 - 0
celery/bin/base.py

@@ -55,6 +55,11 @@ class Command(object):
 
     def parse_options(self, prog_name, arguments):
         """Parse the available options."""
+        # Don't want to load configuration to just print the version,
+        # so we handle --version manually here.
+        if "--version" in arguments:
+            print(self.version)
+            sys.exit(0)
         parser = self.create_parser(prog_name)
         options, args = parser.parse_args(arguments)
         return options, args