浏览代码

celery command now works with execv

Ask Solem 13 年之前
父节点
当前提交
2802c72b7e
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      celery/bin/celery.py

+ 7 - 0
celery/bin/celery.py

@@ -5,6 +5,7 @@ from __future__ import with_statement
 import anyjson
 import sys
 
+from billiard import freeze_support
 from importlib import import_module
 from pprint import pformat
 from textwrap import wrap
@@ -551,6 +552,12 @@ def determine_exit_status(ret):
 
 
 def main():
+    # Fix for setuptools generated scripts, so that it will
+    # work with multiprocessing fork emulation.
+    # (see multiprocessing.forking.get_preparation_data())
+    if __name__ != "__main__":  # pragma: no cover
+        sys.modules["__main__"] = sys.modules[__name__]
+    freeze_support()
     CeleryCommand().execute_from_commandline()
 
 if __name__ == "__main__":          # pragma: no cover