 Chromium Code Reviews
 Chromium Code Reviews Issue 1208743002:
  Changes to improve multiprocessing PRESUBMIT support in Windows  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
    
  
    Issue 1208743002:
  Changes to improve multiprocessing PRESUBMIT support in Windows  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master| Index: presubmit_support.py | 
| diff --git a/presubmit_support.py b/presubmit_support.py | 
| index 4baee778831d229386738d1a42d1a3b2b5ebef88..523bb79a1245f4c30534bea2e90ac447dda49aba 100755 | 
| --- a/presubmit_support.py | 
| +++ b/presubmit_support.py | 
| @@ -313,6 +313,12 @@ class InputApi(object): | 
| self.cpu_count = multiprocessing.cpu_count() | 
| + # this is done here because in RunTests, the current working directory has | 
| + # changed, which causes Pool() to explode fantastically when run on windows | 
| + # (because it tries to load the __main__ module, which imports lots of | 
| + # things relative to the current working directory). | 
| + self._run_tests_pool = multiprocessing.Pool(self.cpu_count) | 
| 
iannucci
2015/06/28 19:47:43
this is so we pick up the mocked cpu_count
 | 
| + | 
| # The local path of the currently-being-processed presubmit script. | 
| self._current_presubmit_path = os.path.dirname(presubmit_path) | 
| @@ -492,11 +498,8 @@ class InputApi(object): | 
| if self.verbose: | 
| t.info = _PresubmitNotifyResult | 
| if len(tests) > 1 and parallel: | 
| - pool = multiprocessing.Pool() | 
| # async recipe works around multiprocessing bug handling Ctrl-C | 
| - msgs.extend(pool.map_async(CallCommand, tests).get(99999)) | 
| - pool.close() | 
| - pool.join() | 
| + msgs.extend(self._run_tests_pool.map_async(CallCommand, tests).get(99999)) | 
| else: | 
| msgs.extend(map(CallCommand, tests)) | 
| return [m for m in msgs if m] |