From e852ac71f91f6fe8e515dcc3f52d17f77d421cfe Mon Sep 17 00:00:00 2001 From: Akhil Lawrence Date: Wed, 29 Jan 2025 07:32:34 +0530 Subject: [PATCH] mark shell=False in ExecProvider for linux/darwin platforms --- kubernetes/base/config/exec_provider.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kubernetes/base/config/exec_provider.py b/kubernetes/base/config/exec_provider.py index 317a56695..c11c2a5f4 100644 --- a/kubernetes/base/config/exec_provider.py +++ b/kubernetes/base/config/exec_provider.py @@ -58,6 +58,15 @@ def __init__(self, exec_config, cwd, cluster=None): else: self.cluster = None self.cwd = cwd or None + + @property + def shell(self): + # for windows systems `shell` should be `True` + # for other systems like linux or darwin `shell` should be `False` + # referenes: + # https://github.com/kubernetes-client/python/pull/2289 + # https://docs.python.org/3/library/sys.html#sys.platform + return sys.platform in ("win32", "cygwin") def run(self, previous_response=None): is_interactive = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty() @@ -82,7 +91,7 @@ def run(self, previous_response=None): cwd=self.cwd, env=self.env, universal_newlines=True, - shell=True) + shell=self.shell) (stdout, stderr) = process.communicate() exit_code = process.wait() if exit_code != 0: