summaryrefslogtreecommitdiffstats
path: root/src/browse.py
diff options
context:
space:
mode:
authorPhilip Puryear <philippuryear@gmail.com>2012-12-08 00:22:19 (GMT)
committerPhilip Puryear <philippuryear@gmail.com>2012-12-08 00:22:19 (GMT)
commit2ea3638cb2e75197764584f7dd715cc97f68c8c5 (patch)
treeab09c26f95f44996c296f42e295aec5c66f1ccca /src/browse.py
parent991d5e0181ffe8826936ffd549bfbae63d2928ae (diff)
downloadNinja-2ea3638cb2e75197764584f7dd715cc97f68c8c5.zip
Ninja-2ea3638cb2e75197764584f7dd715cc97f68c8c5.tar.gz
Ninja-2ea3638cb2e75197764584f7dd715cc97f68c8c5.tar.bz2
browse: Read ninja's error text from stderr.
Diffstat (limited to 'src/browse.py')
-rwxr-xr-xsrc/browse.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/browse.py b/src/browse.py
index 14d5edd..7f15e50 100755
--- a/src/browse.py
+++ b/src/browse.py
@@ -144,8 +144,9 @@ def generate_html(node):
def ninja_dump(target):
proc = subprocess.Popen([sys.argv[1], '-t', 'query', target],
- stdout=subprocess.PIPE, universal_newlines=True)
- return (proc.communicate()[0], proc.returncode)
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ universal_newlines=True)
+ return proc.communicate() + (proc.returncode,)
class RequestHandler(httpserver.BaseHTTPRequestHandler):
def do_GET(self):
@@ -164,12 +165,12 @@ class RequestHandler(httpserver.BaseHTTPRequestHandler):
return
target = target[1:]
- input, exit_code = ninja_dump(target)
+ ninja_output, ninja_error, exit_code = ninja_dump(target)
if exit_code == 0:
- page_body = generate_html(parse(input.strip()))
+ page_body = generate_html(parse(ninja_output.strip()))
else:
# Relay ninja's error message.
- page_body = '<h1><tt>%s</tt></h1>' % input
+ page_body = '<h1><tt>%s</tt></h1>' % ninja_error
self.send_response(200)
self.end_headers()