Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
b971eee
1
Parent(s):
10ff16a
Only decode if progress turned on
Browse files- pysr/sr.py +10 -5
pysr/sr.py
CHANGED
@@ -385,14 +385,19 @@ def _cmd_runner(command, **kwargs):
|
|
385 |
while True:
|
386 |
line = process.stdout.readline()
|
387 |
if not line: break
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
|
|
|
|
|
|
|
|
393 |
print(decoded_line, end='')
|
394 |
|
395 |
|
|
|
396 |
process.stdout.close()
|
397 |
process.wait()
|
398 |
except KeyboardInterrupt:
|
|
|
385 |
while True:
|
386 |
line = process.stdout.readline()
|
387 |
if not line: break
|
388 |
+
if kwargs['progress']:
|
389 |
+
decoded_line = (line.decode('utf-8')
|
390 |
+
.replace('\\033[K', '\033[K')
|
391 |
+
.replace('\\033[1A', '\033[1A')
|
392 |
+
.replace('\\033[1B', '\033[1B')
|
393 |
+
.replace('\\r', '\r'))
|
394 |
+
else:
|
395 |
+
decoded_line = line.decode('utf-8')
|
396 |
+
|
397 |
print(decoded_line, end='')
|
398 |
|
399 |
|
400 |
+
|
401 |
process.stdout.close()
|
402 |
process.wait()
|
403 |
except KeyboardInterrupt:
|