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

Side by Side Diff: dart/tools/build.py

Issue 13794003: Redirect tput stderr to /dev/null. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 # 6 #
7 7
8 import optparse 8 import optparse
9 import os 9 import os
10 import re 10 import re
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 section = None 261 section = None
262 chunk = [] 262 chunk = []
263 # Is stdout a terminal which supports colors? 263 # Is stdout a terminal which supports colors?
264 is_fancy_tty = False 264 is_fancy_tty = False
265 clr_eol = None 265 clr_eol = None
266 if sys.stdout.isatty(): 266 if sys.stdout.isatty():
267 term = os.getenv('TERM', 'dumb') 267 term = os.getenv('TERM', 'dumb')
268 # The capability "clr_eol" means clear the line from cursor to end 268 # The capability "clr_eol" means clear the line from cursor to end
269 # of line. See man pages for tput and terminfo. 269 # of line. See man pages for tput and terminfo.
270 try: 270 try:
271 clr_eol = subprocess.check_output(['tput', '-T' + term, 'el'], 271 with open('/dev/null', 'a') as dev_null:
272 stderr=subprocess.STDOUT) 272 clr_eol = subprocess.check_output(['tput', '-T' + term, 'el'],
273 stderr=dev_null)
273 if clr_eol: 274 if clr_eol:
274 is_fancy_tty = True 275 is_fancy_tty = True
275 except subprocess.CalledProcessError: 276 except subprocess.CalledProcessError:
276 is_fancy_tty = False 277 is_fancy_tty = False
277 pattern = re.compile(r'=== BUILD .* TARGET (.*) OF PROJECT (.*) WITH ' + 278 pattern = re.compile(r'=== BUILD .* TARGET (.*) OF PROJECT (.*) WITH ' +
278 r'CONFIGURATION (.*) ===') 279 r'CONFIGURATION (.*) ===')
279 has_interesting_info = False 280 has_interesting_info = False
280 for line in unbuffered(process.stdout.readline): 281 for line in unbuffered(process.stdout.readline):
281 line = line.rstrip() 282 line = line.rstrip()
282 if line.startswith('=== BUILD ') or line.startswith('** BUILD '): 283 if line.startswith('=== BUILD ') or line.startswith('** BUILD '):
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 process.wait() 425 process.wait()
425 if process.returncode != 0: 426 if process.returncode != 0:
426 print "BUILD FAILED" 427 print "BUILD FAILED"
427 return 1 428 return 1
428 429
429 return 0 430 return 0
430 431
431 432
432 if __name__ == '__main__': 433 if __name__ == '__main__':
433 sys.exit(Main()) 434 sys.exit(Main())
OLDNEW
« 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