Remove progress info from snapraid output

This commit is contained in:
Chronial committed 2021-09-25 22:58:37 +02:00
1 parent 4cb7e695af
commit 8acd9315dd
2 files changed
+6 -9

No files matched your search

+2
View File
@@ -40,6 +40,8 @@ feature you are missing, you can have a look
### Unreleased ### Unreleased
* Add --ignore-deletethreshold (by exterrestris, #25) * Add --ignore-deletethreshold (by exterrestris, #25)
* Add support for scrub --plan, replacing --percentage * Add support for scrub --plan, replacing --percentage
* Remove snapraid progress output. Was accidentially introduced with python3
support.
### v0.5 (26 Feb 2021) ### v0.5 (26 Feb 2021)
* Remove (broken) python2 support * Remove (broken) python2 support
+4 -9
View File
@@ -26,11 +26,7 @@ def tee_log(infile, out_lines, log_level):
""" """
def tee_thread(): def tee_thread():
for line in iter(infile.readline, ""): for line in iter(infile.readline, ""):
line = line.strip() logging.log(log_level, line.rstrip())
# Do not log the progress display
if "\r" in line:
line = line.split("\r")[-1]
logging.log(log_level, line.strip())
out_lines.append(line) out_lines.append(line)
infile.close() infile.close()
t = threading.Thread(target=tee_thread) t = threading.Thread(target=tee_thread)
@@ -44,19 +40,18 @@ def snapraid_command(command, args={}, *, allow_statuscodes=[]):
Run snapraid command Run snapraid command
Raises subprocess.CalledProcessError if errorlevel != 0 Raises subprocess.CalledProcessError if errorlevel != 0
""" """
arguments = ["--conf", config["snapraid"]["config"]] arguments = ["--conf", config["snapraid"]["config"],
"--quiet"]
for (k, v) in args.items(): for (k, v) in args.items():
arguments.extend(["--" + k, str(v)]) arguments.extend(["--" + k, str(v)])
p = subprocess.Popen( p = subprocess.Popen(
[config["snapraid"]["executable"], command] + arguments, [config["snapraid"]["executable"], command] + arguments,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
universal_newlines=True,
# Snapraid always outputs utf-8 on windows. On linux, utf-8 # Snapraid always outputs utf-8 on windows. On linux, utf-8
# also seems a sensible assumption. # also seems a sensible assumption.
encoding="utf-8", encoding="utf-8",
errors="replace" errors="replace")
)
out = [] out = []
threads = [ threads = [
tee_log(p.stdout, out, logging.OUTPUT), tee_log(p.stdout, out, logging.OUTPUT),