diff options
author | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2020-05-06 13:26:12 +0100 |
---|---|---|
committer | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2020-05-06 13:30:28 +0100 |
commit | c5f92b037208f4ffd96cadc2acbcaafce8bf858e (patch) | |
tree | abecb65401301a92de649e24133a74cd31db7f3b /lorry-controller-minion | |
parent | 1dd8feaee55c5f530528b59019a2ad3c357f2905 (diff) | |
download | lorry-controller-c5f92b037208f4ffd96cadc2acbcaafce8bf858e.tar.gz |
Convert output from runcmd{,_unchecked} to text
The cliapp.Application.runcmd{,_unchecked} methods return bytes
objects under Python 3. Decode these as UTF-8 in non-strict (replace)
mode.
Diffstat (limited to 'lorry-controller-minion')
-rwxr-xr-x | lorry-controller-minion | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lorry-controller-minion b/lorry-controller-minion index 0412629..4f3069e 100755 --- a/lorry-controller-minion +++ b/lorry-controller-minion @@ -298,6 +298,9 @@ class MINION(cliapp.Application): def disk_usage_by_dir(self, dirname): exit, out, err = cliapp.runcmd_unchecked(['du', '-sk', dirname]) + if isinstance(out, bytes): + out = out.decode('utf-8', errors='replace') + err = err.decode('utf-8', errors='replace') if exit: logging.error('du -sk %s failed: %r', dirname, err) return 0 |