@@ -213,32 +213,33 @@ def get_pycparser():
213
213
214
214
215
215
def _busy_spinner (evnt ):
216
- while not evnt .is_set ():
217
- sys .stdout .write ('.' )
216
+ if 'GITHUB_RUN_ID' in os .environ :
217
+ while not evnt .is_set ():
218
+ sys .stdout .write ('.' )
219
+ sys .stdout .flush ()
220
+ evnt .wait (2 )
221
+
222
+ else :
223
+ count = random .randint (1 , 25 )
224
+ wait = random .randint (10 , 100 ) * 0.001
225
+ chars = '\\ |/-'
226
+ char_index = 0
227
+ sys .stdout .write (chars [char_index ] + '\r ' )
218
228
sys .stdout .flush ()
219
- evnt .wait (2 )
220
-
221
- # else:
222
- # count = random.randint(1, 25)
223
- # wait = random.randint(10, 100) * 0.001
224
- # chars = '\\|/-'
225
- # char_index = 0
226
- # sys.stdout.write(chars[char_index] + '\r')
227
- # sys.stdout.flush()
228
- #
229
- # while not evnt.is_set():
230
- # evnt.wait(wait)
231
- # count -= 1
232
- # char_index += 1
233
- # if char_index == 4:
234
- # char_index = 0
235
- #
236
- # sys.stdout.write(f'{chars[char_index]}\r')
237
- # sys.stdout.flush()
238
- #
239
- # if count == 0:
240
- # count = random.randint(1, 25)
241
- # wait = random.randint(10, 100) * 0.001
229
+
230
+ while not evnt .is_set ():
231
+ evnt .wait (wait )
232
+ count -= 1
233
+ char_index += 1
234
+ if char_index == 4 :
235
+ char_index = 0
236
+
237
+ sys .stdout .write (f'{ chars [char_index ]} \r ' )
238
+ sys .stdout .flush ()
239
+
240
+ if count == 0 :
241
+ count = random .randint (1 , 25 )
242
+ wait = random .randint (10 , 100 ) * 0.001
242
243
243
244
244
245
def spawn (cmd_ , out_to_screen = True , spinner = False , env = None , cmpl = False ):
@@ -356,6 +357,9 @@ def _convert_line(lne):
356
357
event .set ()
357
358
t .join ()
358
359
360
+ sys .stdout .write ('\n ' )
361
+ sys .stdout .flush ()
362
+
359
363
output_buffer = '\n ' .join (output_buffer )
360
364
361
365
if out_to_screen :
0 commit comments