Skip to content

Commit 038f8d7

Browse files
zFernand0t1m0thyj
andcommitted
review: best to past an env_copy. Thanks @t1m0thyj
Co-authored-by: Timothy Johnson <timothy.johnson@broadcom.com> Signed-off-by: Fernando Rijo Cedeno <37381190+zFernand0@users.noreply.github.com>
1 parent 84da242 commit 038f8d7

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

python/pyzowe/pyzowe.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,14 @@ def zowe(arguments: str):
8383
for job in zowe("zos-jobs list jobs"):
8484
print(f"Job {job['jobid']} has return code {job['retcode']}")
8585
"""
86-
old_color = os.environ['FORCE_COLOR']
87-
os.environ['FORCE_COLOR'] = "0"
8886
zowe_command = "zowe " + arguments + " --rfj"
8987

9088
try:
89+
temp_env = os.environ.copy()
90+
# temp_env['FORCE_COLOR'] = "0"
9191
completed_process = subprocess.run(
92-
zowe_command, shell=True, capture_output=True, check=True, encoding="utf8")
92+
zowe_command, shell=True, capture_output=True, check=True, encoding="utf8", env=temp_env)
9393
parsed_output = json.loads(completed_process.stdout)
9494
return parsed_output.get("data", parsed_output)
9595
except subprocess.CalledProcessError as e:
96-
raise ZoweCallError(e.returncode, e.cmd, arguments,
97-
output=e.output, stderr=e.stderr)
98-
finally:
99-
os.environ['FORCE_COLOR'] = old_color
96+
raise ZoweCallError(e.returncode, e.cmd, arguments, output=e.output, stderr=e.stderr)

0 commit comments

Comments
 (0)