changeset 566:8073ae8cb164

bake: Don't re-setup logging for workers unless we're sure we need it.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 10 Oct 2015 23:02:40 -0700
parents ff714d7f074d
children a65f04ddbea2
files piecrust/workerpool.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/workerpool.py	Fri Oct 09 16:49:12 2015 -0700
+++ b/piecrust/workerpool.py	Sat Oct 10 23:02:40 2015 -0700
@@ -47,8 +47,10 @@
     # In a context where `multiprocessing` is using the `spawn` forking model,
     # the new process doesn't inherit anything, so we lost all our logging
     # configuration here. Let's set it up again.
-    from piecrust.main import _pre_parse_chef_args
-    _pre_parse_chef_args(sys.argv[1:])
+    if (hasattr(multiprocessing, 'get_start_method') and
+            multiprocessing.get_start_method() == 'spawn'):
+        from piecrust.main import _pre_parse_chef_args
+        _pre_parse_chef_args(sys.argv[1:])
 
     wid = params.wid
     logger.debug("Worker %d initializing..." % wid)