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

Unified Diff: third_party/WebKit/Source/build/scripts/make_css_value_keywords.py

Issue 2691083003: webkit: Catch OSError for when gperf isn't avaliable. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/build/scripts/make_css_value_keywords.py
diff --git a/third_party/WebKit/Source/build/scripts/make_css_value_keywords.py b/third_party/WebKit/Source/build/scripts/make_css_value_keywords.py
index f86922f76afad5f783c9b7826656c850b36aed58..c39804676260e4c1f96f6541af64b3f914b10aa3 100755
--- a/third_party/WebKit/Source/build/scripts/make_css_value_keywords.py
+++ b/third_party/WebKit/Source/build/scripts/make_css_value_keywords.py
@@ -165,8 +165,16 @@ class CSSValueKeywordsWriter(json5_generator.Writer):
gperf_args = [self.gperf_path, '--key-positions=*', '-P', '-n']
gperf_args.extend(['-m', '50']) # Pick best of 50 attempts.
gperf_args.append('-D') # Allow duplicate hashes -> More compact code.
- gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True)
- return gperf.communicate(gperf_input)[0]
+
+ # If gperf isn't in the path we get an OSError. We don't want to use
+ # the normal solution of shell=True (as this has to run on many
+ # platforms), so instead we catch the error and raise a
+ # CalledProcessError like subprocess would do when shell=True is set.
+ try:
+ gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=True)
+ return gperf.communicate(gperf_input)[0]
+ except OSError:
+ raise subprocess.CalledProcessError(127, gperf_args, output='Command not found.')
if __name__ == "__main__":
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698