Skip to content

Commit

Permalink
Fix aria and 7z progress update formatting in log
Browse files Browse the repository at this point in the history
  • Loading branch information
drojf committed May 29, 2023
1 parent e073a91 commit 29ef8ca
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion common.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,18 @@ def readUntilEOF(proc, fileLikeObject):
character = fileLikeObject.read(1).decode(encoding='utf-8', errors='replace')

if character:
if character == '\r':
character = ' '

stringBuffer.append(character)

writeOutBuffer = False
writeOutCausedByNewline = False

# Write out buffer if newline detected
if character == '\n':
writeOutBuffer = True
writeOutCausedByNewline = True

# Insert newline after ']' characters
if ariaMode and character == ']':
Expand All @@ -444,7 +449,12 @@ def readUntilEOF(proc, fileLikeObject):

if writeOutBuffer:
line = ''.join(stringBuffer)
print(line, end='')

if writeOutCausedByNewline:
print(line, end='')
else:
print(line.lstrip(), end='')

if lineMonitor:
lineMonitor.process(line)
stringBuffer = []
Expand Down

0 comments on commit 29ef8ca

Please sign in to comment.