Index: pylib/gyp/input.py |
diff --git a/pylib/gyp/input.py b/pylib/gyp/input.py |
index 671420f0cef11b7a620db96ea290793d10467f3c..5248406041393cc20c9a8ab2caf119e02613b061 100644 |
--- a/pylib/gyp/input.py |
+++ b/pylib/gyp/input.py |
@@ -17,6 +17,7 @@ import optparse |
import os.path |
import re |
import shlex |
+import signal |
import subprocess |
import sys |
import threading |
@@ -456,6 +457,8 @@ def CallLoadTargetBuildFile(global_flags, |
a worker process. |
""" |
+ signal.signal(signal.SIGINT, signal.SIG_IGN) |
+ |
# Apply globals so that the worker process behaves the same. |
for key, value in global_flags.iteritems(): |
globals()[key] = value |
@@ -547,32 +550,36 @@ def LoadTargetBuildFileParallel(build_file_path, data, aux_data, |
parallel_state.data = data |
parallel_state.aux_data = aux_data |
- parallel_state.condition.acquire() |
- while parallel_state.dependencies or parallel_state.pending: |
- if not parallel_state.dependencies: |
- parallel_state.condition.wait() |
- continue |
+ try: |
+ parallel_state.condition.acquire() |
+ while parallel_state.dependencies or parallel_state.pending: |
+ if not parallel_state.dependencies: |
+ parallel_state.condition.wait() |
+ continue |
- dependency = parallel_state.dependencies.pop() |
- |
- parallel_state.pending += 1 |
- data_in = {} |
- data_in['target_build_files'] = data['target_build_files'] |
- aux_data_in = {} |
- global_flags = { |
- 'path_sections': globals()['path_sections'], |
- 'non_configuration_keys': globals()['non_configuration_keys'], |
- 'absolute_build_file_paths': globals()['absolute_build_file_paths'], |
- 'multiple_toolsets': globals()['multiple_toolsets']} |
- |
- if not parallel_state.pool: |
- parallel_state.pool = multiprocessing.Pool(8) |
- parallel_state.pool.apply_async( |
- CallLoadTargetBuildFile, |
- args = (global_flags, dependency, |
- data_in, aux_data_in, |
- variables, includes, depth, check), |
- callback = parallel_state.LoadTargetBuildFileCallback) |
+ dependency = parallel_state.dependencies.pop() |
+ |
+ parallel_state.pending += 1 |
+ data_in = {} |
+ data_in['target_build_files'] = data['target_build_files'] |
+ aux_data_in = {} |
+ global_flags = { |
+ 'path_sections': globals()['path_sections'], |
+ 'non_configuration_keys': globals()['non_configuration_keys'], |
+ 'absolute_build_file_paths': globals()['absolute_build_file_paths'], |
+ 'multiple_toolsets': globals()['multiple_toolsets']} |
+ |
+ if not parallel_state.pool: |
+ parallel_state.pool = multiprocessing.Pool(8) |
+ parallel_state.pool.apply_async( |
+ CallLoadTargetBuildFile, |
+ args = (global_flags, dependency, |
+ data_in, aux_data_in, |
+ variables, includes, depth, check), |
+ callback = parallel_state.LoadTargetBuildFileCallback) |
+ except KeyboardInterrupt, e: |
+ parallel_state.pool.terminate() |
+ raise e |
parallel_state.condition.release() |