From 0ab2ba73018675187ed932dc0b421488af17600a Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sun, 16 Aug 2015 19:00:00 +0200 Subject: 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 --- base/java-tools/bin/pki | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'base/java-tools') 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' -- cgit