From 93572fb73450d2421878932f1e53171af4e611be Mon Sep 17 00:00:00 2001 From: Chronial Date: Sun, 19 Apr 2020 14:36:16 +0200 Subject: [PATCH] Fix snapraid output encoding handling (#31) --- README.md | 3 +++ snapraid-runner.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 71406ba..41bc905 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,9 @@ It supports Windows, Linux and macOS and runs on both python2 and python3. * Can run `scrub` after `sync` ## Changelog +### Unreleased +* Fix snapraid output encoding handling (by hyyz17200, PR-31) + ### v0.4 (17 Aug 2019) * Add compatibility with python3 (by reed-jones) * Add support for running `snapraid touch` (by ShoGinn, PR-11) diff --git a/snapraid-runner.py b/snapraid-runner.py index 71d87c4..3fb9389 100644 --- a/snapraid-runner.py +++ b/snapraid-runner.py @@ -57,7 +57,11 @@ def snapraid_command(command, args={}, *, allow_statuscodes=[]): [config["snapraid"]["executable"], command] + arguments, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - universal_newlines=True + universal_newlines=True, + # Snapraid always outputs utf-8 on windows. On linux, utf-8 + # also seems a sensible assumption. + encoding="utf-8", + errors="replace" ) out = [] threads = [