From 7103dcb4450dae595651f22e086a731f21e426b4 Mon Sep 17 00:00:00 2001 From: Parikshit Tiwari Date: Sun, 2 Jun 2024 15:59:09 +0530 Subject: [PATCH 1/3] Fix incorrect string operations on bytes output of 'ps' subprocess Signed-off-by: Parikshit Tiwari --- src/rez/system.py | 14 +++++++++++--- src/rez/utils/_version.py | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/rez/system.py b/src/rez/system.py index 25780c1e7..ef1ae9e8f 100644 --- a/src/rez/system.py +++ b/src/rez/system.py @@ -86,9 +86,17 @@ def shell(self): # print an error message: "process ID out of range". try: args = ['ps', '-o', 'args=', '-p', str(parent_pid)] - proc = sp.Popen(args, stdout=sp.PIPE) - output = proc.communicate()[0] - shell = os.path.basename(output.strip().split()[0]).replace('-', '') + finished_proc = sp.run( + args, + capture_output=True, + check=True, + text=True, + ) + output = finished_proc.stdout + shell = os.path.basename( + output.strip().split()[0]).replace( + '-', '' + ) except Exception: pass diff --git a/src/rez/utils/_version.py b/src/rez/utils/_version.py index f4fd4ec01..74f1a4304 100644 --- a/src/rez/utils/_version.py +++ b/src/rez/utils/_version.py @@ -4,4 +4,4 @@ # Update this value to version up Rez. Do not place anything else in this file. # Using .devN allows us to run becnmarks and create proper benchmark reports on PRs. -_rez_version = "3.1.1" +_rez_version = "3.1.2" From 8699a35290545298348d97b15a674c6aa55b583f Mon Sep 17 00:00:00 2001 From: Jean-Christophe Morin Date: Sat, 29 Jun 2024 10:35:45 -0400 Subject: [PATCH 2/3] Change back to Popen Signed-off-by: Jean-Christophe Morin --- src/rez/system.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/rez/system.py b/src/rez/system.py index ef1ae9e8f..8486a71af 100644 --- a/src/rez/system.py +++ b/src/rez/system.py @@ -86,17 +86,9 @@ def shell(self): # print an error message: "process ID out of range". try: args = ['ps', '-o', 'args=', '-p', str(parent_pid)] - finished_proc = sp.run( - args, - capture_output=True, - check=True, - text=True, - ) - output = finished_proc.stdout - shell = os.path.basename( - output.strip().split()[0]).replace( - '-', '' - ) + proc = sp.Popen(args, stdout=sp.PIPE, text=True) + output = proc.communicate()[0] + shell = os.path.basename(output.strip().split()[0]).replace('-', '') except Exception: pass From 839d5aa84794c7e07bb94e1ce6c790d9c325019f Mon Sep 17 00:00:00 2001 From: Jean-Christophe Morin Date: Sat, 29 Jun 2024 10:36:35 -0400 Subject: [PATCH 3/3] Undo version change Signed-off-by: Jean-Christophe Morin --- src/rez/utils/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rez/utils/_version.py b/src/rez/utils/_version.py index 74f1a4304..f4fd4ec01 100644 --- a/src/rez/utils/_version.py +++ b/src/rez/utils/_version.py @@ -4,4 +4,4 @@ # Update this value to version up Rez. Do not place anything else in this file. # Using .devN allows us to run becnmarks and create proper benchmark reports on PRs. -_rez_version = "3.1.2" +_rez_version = "3.1.1"