Commit c1367ba1 authored by thakis@chromium.org's avatar thakis@chromium.org

gn docs generator: Don't get confused by ansi escape codes.

BUG=362239
TEST=links at the top of the output actually work.
NOTRY=true

Review URL: https://codereview.chromium.org/232703004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263087 0039d316-1c4b-4281-b951-d872f2087c98
parent 07a8725b
......@@ -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 ''
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment