File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313import re
1414import subprocess
1515import sys
16- import time
1716
1817buildroot_dir = os .path .abspath (os .path .join (os .path .realpath (__file__ ), '..' , '..' , '..' ))
1918out_dir = os .path .join (buildroot_dir , 'out' )
2524
2625fml_unittests_filter = '--gtest_filter=-*TimeSensitiveTest*'
2726
28- def PrintDivider (char = '=' ):
29- print '\n '
30- for _ in xrange (4 ):
31- print ('' .join ([char for _ in xrange (80 )]))
32- print '\n '
33-
3427def RunCmd (cmd , ** kwargs ):
35- command_string = ' ' .join (cmd )
36-
37- PrintDivider ('>' )
38- print 'Running command "%s"' % command_string
39-
40- start_time = time .time ()
41- process = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .STDOUT , ** kwargs )
42- (output , _ ) = process .communicate ()
43- end_time = time .time ()
44-
45- # Print the result no matter what.
46- for line in output .splitlines ():
47- print line
48-
49- if process .returncode != 0 :
50- PrintDivider ('!' )
51- raise Exception ('Command "%s" exited with code %d' % (command_string , process .returncode ))
52-
53- PrintDivider ('<' )
54- print 'Command run successfully in %.2f seconds: %s' % (end_time - start_time , command_string )
55-
28+ try :
29+ print (subprocess .check_output (cmd , ** kwargs ))
30+ except subprocess .CalledProcessError as cpe :
31+ print (cpe .output )
32+ raise cpe
5633
5734def IsMac ():
5835 return sys .platform == 'darwin'
You can’t perform that action at this time.
0 commit comments