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

Unified Diff: tools/gn/bin/help_as_html.py

Issue 232703004: gn docs generator: Don't get confused by ansi escape codes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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: tools/gn/bin/help_as_html.py
diff --git a/tools/gn/bin/help_as_html.py b/tools/gn/bin/help_as_html.py
index f8f1c1bc271cf80fb5427c71db1c22286bd9edaf..9dfea3175628681f32087e382955db4b45bb4539 100755
--- a/tools/gn/bin/help_as_html.py
+++ b/tools/gn/bin/help_as_html.py
@@ -12,13 +12,17 @@
# - Spit out other similar formats like wiki, markdown, whatever.
import cgi
+import re
import subprocess
import sys
def GetOutput(*args):
try:
- return subprocess.check_output([sys.argv[1]] + list(args))
+ # TODO: Remove ansi escape code stripping if crbug.com/362239 gets fixed.
+ ansi_escape = re.compile(r'\x1b[^m]*m')
+ return ansi_escape.sub(
+ '', subprocess.check_output([sys.argv[1]] + list(args)))
except subprocess.CalledProcessError:
return ''
« 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