diff options
author | Christian Heimes <cheimes@redhat.com> | 2015-08-16 19:00:00 +0200 |
---|---|---|
committer | Christian Heimes <cheimes@redhat.com> | 2015-08-17 21:14:12 +0200 |
commit | 0ab2ba73018675187ed932dc0b421488af17600a (patch) | |
tree | 8cef2fc045bcdbca93c947ec7ed0bdc088e478be /base/java-tools | |
parent | 74a355185eeb30e7d42ff2d29c4c3c3c298b2a12 (diff) | |
download | pki-0ab2ba73018675187ed932dc0b421488af17600a.tar.gz pki-0ab2ba73018675187ed932dc0b421488af17600a.tar.xz pki-0ab2ba73018675187ed932dc0b421488af17600a.zip |
Py3 compatibility: encode output of subprocess call
In Python 3 subprocess.Popen() and check_out() return bytes. The rest of
PKI expects text, so the output has to be decoded.
- ascii for dnsdomainname
- sys.getfilesystemencoding() for paths
- utf-8 for the rest
Diffstat (limited to 'base/java-tools')
-rw-r--r-- | base/java-tools/bin/pki | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/base/java-tools/bin/pki b/base/java-tools/bin/pki index 568093892..4b8e69a55 100644 --- a/base/java-tools/bin/pki +++ b/base/java-tools/bin/pki @@ -31,7 +31,7 @@ def run_java_cli(args): value = subprocess.check_output( '. /etc/pki/pki.conf && echo $RESTEASY_LIB', shell=True) - resteasy_lib = str(value).strip() + resteasy_lib = value.decode(sys.getfilesystemencoding()).strip() # construct classpath classpath = [ @@ -92,7 +92,8 @@ def main(argv): value = subprocess.check_output( '. /etc/pki/pki.conf && echo $PKI_CLI_OPTIONS', shell=True) - args = shlex.split(value.strip()) + value = value.decode(sys.getfilesystemencoding()).strip() + args = shlex.split(value) args.extend(argv[1:]) client_type = 'java' |