changeset 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 a406b75c4bea
children 63b2e4c739e1
files piecrust/workerpool.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
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)