From 8acd9315dd0827cd48415d80302900f42c0af667 Mon Sep 17 00:00:00 2001 From: Chronial Date: Sat, 25 Sep 2021 22:58:37 +0200 Subject: [PATCH] Remove progress info from snapraid output --- README.md | 2 ++ snapraid-runner.py | 13 ++++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a1d482d..1e48076 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,8 @@ feature you are missing, you can have a look ### Unreleased * Add --ignore-deletethreshold (by exterrestris, #25) * Add support for scrub --plan, replacing --percentage +* Remove snapraid progress output. Was accidentially introduced with python3 + support. ### v0.5 (26 Feb 2021) * Remove (broken) python2 support diff --git a/snapraid-runner.py b/snapraid-runner.py index f123099..c4c090f 100644 --- a/snapraid-runner.py +++ b/snapraid-runner.py @@ -26,11 +26,7 @@ def tee_log(infile, out_lines, log_level): """ def tee_thread(): for line in iter(infile.readline, ""): - line = line.strip() - # Do not log the progress display - if "\r" in line: - line = line.split("\r")[-1] - logging.log(log_level, line.strip()) + logging.log(log_level, line.rstrip()) out_lines.append(line) infile.close() t = threading.Thread(target=tee_thread) @@ -44,19 +40,18 @@ def snapraid_command(command, args={}, *, allow_statuscodes=[]): Run snapraid command Raises subprocess.CalledProcessError if errorlevel != 0 """ - arguments = ["--conf", config["snapraid"]["config"]] + arguments = ["--conf", config["snapraid"]["config"], + "--quiet"] for (k, v) in args.items(): arguments.extend(["--" + k, str(v)]) p = subprocess.Popen( [config["snapraid"]["executable"], command] + arguments, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - universal_newlines=True, # Snapraid always outputs utf-8 on windows. On linux, utf-8 # also seems a sensible assumption. encoding="utf-8", - errors="replace" - ) + errors="replace") out = [] threads = [ tee_log(p.stdout, out, logging.OUTPUT),