Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: pylib/gyp/input.py

Issue 11098023: Make child process errors kill gyp when parallel processing is on. (Closed) Base URL: http://git.chromium.org/external/gyp.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« pylib/gyp/generator/ninja.py ('K') | « pylib/gyp/generator/ninja.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« pylib/gyp/generator/ninja.py ('K') | « pylib/gyp/generator/ninja.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698