From e1fdf948d4588f7e763907c31b246a3dfacc8ca9 Mon Sep 17 00:00:00 2001 From: Terence Tuhinanshu Date: Tue, 2 Jul 2024 21:17:58 -0400 Subject: [PATCH] Interpret subprocess output as strings Previously the subprocess output would be reported as byte strings, which in Python 3.10 would add a b'' prefix, interfering with the output. By interpreting them as proper UTF-8 strings, we ensure that the original functionality is restored. --- deployment/packer/driver.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/deployment/packer/driver.py b/deployment/packer/driver.py index d479bc53b..0d68d19a7 100644 --- a/deployment/packer/driver.py +++ b/deployment/packer/driver.py @@ -59,7 +59,9 @@ def get_git_sha(): 'rev-parse', 'HEAD'] - return subprocess.check_output(git_command).rstrip() + return subprocess.check_output( + git_command, + universal_newlines=True).rstrip() def get_git_branch(): @@ -69,7 +71,9 @@ def get_git_branch(): '--abbrev-ref', 'HEAD'] - return subprocess.check_output(git_command).rstrip() + return subprocess.check_output( + git_command, + universal_newlines=True).rstrip() def get_git_desc(): @@ -81,7 +85,9 @@ def get_git_desc(): '--dirty', '--abbrev=40'] - return subprocess.check_output(git_command).rstrip() + return subprocess.check_output( + git_command, + universal_newlines=True).rstrip() def run_packer(mmw_config, machine_types, aws_profile):