@@ -140,36 +140,44 @@ def repo(self) -> Optional[str]:
140
140
def _run_command (self , cmd ):
141
141
self ._logger .info (cmd )
142
142
143
- stop = threading .Event ()
144
-
145
- def f ():
146
- nonlocal stop
147
- counter = 0
148
- on_travis = "TRAVIS_BRANCH" in os .environ
149
- while not stop .is_set ():
150
- counter = counter + 1
151
-
152
- if on_travis :
153
- print ("Still building... ({})" .format (counter ), flush = True )
154
- stop .wait (10 )
155
- continue
156
-
157
- print ("." , end = "" , flush = True )
158
- stop .wait (1 )
159
- if not on_travis :
160
- print ()
161
- threading .Thread (target = f ).start ()
162
- try :
163
- output = execute (cmd )
164
- self ._logger .debug ("$ %s\n %s" , cmd , output )
165
- stop .set ()
166
- except CalledProcessError as e :
167
- stop .set ()
168
- print (e .output .decode (), end = "" , flush = True )
169
- raise SystemExit (1 )
170
- except :
171
- stop .set ()
172
- raise
143
+ on_travis = "TRAVIS_BRANCH" in os .environ
144
+
145
+ if on_travis :
146
+ stop = threading .Event ()
147
+
148
+ def f ():
149
+ nonlocal stop
150
+ counter = 0
151
+
152
+ while not stop .is_set ():
153
+ counter = counter + 1
154
+
155
+ if on_travis :
156
+ print ("Still building... ({})" .format (counter ), flush = True )
157
+ stop .wait (10 )
158
+ continue
159
+
160
+ print ("." , end = "" , flush = True )
161
+ stop .wait (1 )
162
+ if not on_travis :
163
+ print ()
164
+ threading .Thread (target = f ).start ()
165
+ try :
166
+ output = execute (cmd )
167
+ self ._logger .debug ("$ %s\n %s" , cmd , output )
168
+ stop .set ()
169
+ except CalledProcessError as e :
170
+ stop .set ()
171
+ print (e .output .decode (), end = "" , flush = True )
172
+ raise SystemExit (1 )
173
+ except :
174
+ stop .set ()
175
+ raise
176
+ else :
177
+ print ("\033 [1m$ %s\033 [0m" % cmd )
178
+ exit_code = os .system (cmd )
179
+ if exit_code != 0 :
180
+ raise RuntimeError ("The command exits with non-zero code %s" % exit_code )
173
181
174
182
def _build (self , args : List [str ], build_dir : str , build_tag : str ) -> None :
175
183
cmd = "docker build {} {}" .format (" " .join (args ), build_dir )
0 commit comments