diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2019-11-01 09:54:29 +1000 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2019-11-01 10:24:03 +0200 |
commit | f4a0f7388275ef949af635cb1c6877e2083388b2 (patch) | |
tree | 17c38fd31d1a4b8cca8b3c1fc49882dd48899b86 /test | |
parent | 7832cc727c2c6a9f4e533aa999d9901d629b6187 (diff) | |
download | xorg-lib-libxkbcommon-f4a0f7388275ef949af635cb1c6877e2083388b2.tar.gz |
test: xkeyboard-config: use universal_newlines instead of decode
This way stdin/stdout of the process are opened in text mode and we don't need
manually decode.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test')
-rwxr-xr-x | test/xkeyboard-config-test.py.in | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/xkeyboard-config-test.py.in b/test/xkeyboard-config-test.py.in index e965858..fbc4784 100755 --- a/test/xkeyboard-config-test.py.in +++ b/test/xkeyboard-config-test.py.in @@ -57,12 +57,13 @@ def xkbcommontool(rmlvo): print(':: {}'.format(' '.join(args)), file=out) try: - output = subprocess.check_output(args, stderr=subprocess.STDOUT) + output = subprocess.check_output(args, stderr=subprocess.STDOUT, + universal_newlines=True) if verbose: - print(output.decode('utf-8'), file=out) + print(output, file=out) except subprocess.CalledProcessError as err: print('ERROR: Failed to compile: {}'.format(' '.join(args)), file=out) - print(err.output.decode('utf-8'), file=out) + print(err.output, file=out) success = False return success, out.getvalue() @@ -101,20 +102,21 @@ def xkbcomp(rmlvo): setxkbmap = subprocess.Popen(args, stdout=subprocess.PIPE) xkbcomp = subprocess.Popen(xkbcomp_args, stdin=setxkbmap.stdout, - stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + universal_newlines=True) setxkbmap.stdout.close() stdout, stderr = xkbcomp.communicate() if xkbcomp.returncode != 0: print('ERROR: Failed to compile: {}'.format(' '.join(args)), file=out) success = False if xkbcomp.returncode != 0 or verbose: - print(stdout.decode('utf-8'), file=out) - print(stderr.decode('utf-8'), file=out) + print(stdout, file=out) + print(stderr, file=out) # This catches setxkbmap errors. except subprocess.CalledProcessError as err: print('ERROR: Failed to compile: {}'.format(' '.join(args)), file=out) - print(err.output.decode('utf-8'), file=out) + print(err.output, file=out) success = False return success, out.getvalue() |