Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 2ea3638

Browse files
committed
browse: Read ninja's error text from stderr.
1 parent 991d5e0 commit 2ea3638

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/browse.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ def generate_html(node):
144144

145145
def ninja_dump(target):
146146
proc = subprocess.Popen([sys.argv[1], '-t', 'query', target],
147-
stdout=subprocess.PIPE, universal_newlines=True)
148-
return (proc.communicate()[0], proc.returncode)
147+
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
148+
universal_newlines=True)
149+
return proc.communicate() + (proc.returncode,)
149150

150151
class RequestHandler(httpserver.BaseHTTPRequestHandler):
151152
def do_GET(self):
@@ -164,12 +165,12 @@ def do_GET(self):
164165
return
165166
target = target[1:]
166167

167-
input, exit_code = ninja_dump(target)
168+
ninja_output, ninja_error, exit_code = ninja_dump(target)
168169
if exit_code == 0:
169-
page_body = generate_html(parse(input.strip()))
170+
page_body = generate_html(parse(ninja_output.strip()))
170171
else:
171172
# Relay ninja's error message.
172-
page_body = '<h1><tt>%s</tt></h1>' % input
173+
page_body = '<h1><tt>%s</tt></h1>' % ninja_error
173174

174175
self.send_response(200)
175176
self.end_headers()

0 commit comments

Comments
 (0)