diff piecrust/workerpool.py @ 500:22a230d99621

bake: Fix logging configuration for multi-processing on Windows.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 23 Jul 2015 23:04:00 -0700
parents 04abc97dd3b6
children 8073ae8cb164
line wrap: on
line diff
--- a/piecrust/workerpool.py	Thu Jul 23 23:03:33 2015 -0700
+++ b/piecrust/workerpool.py	Thu Jul 23 23:04:00 2015 -0700
@@ -44,6 +44,12 @@
 
 
 def _real_worker_func(params):
+    # 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:])
+
     wid = params.wid
     logger.debug("Worker %d initializing..." % wid)