Merge pull request #2338 from akhilputhiry/2333

mark shell=False in ExecProvider for linux/darwin platforms
This commit is contained in:
Kubernetes Prow Robot 2025-01-31 09:12:56 -08:00 committed by GitHub
commit 065a968e9e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -58,6 +58,15 @@ class ExecProvider(object):
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 @@ class ExecProvider(object):
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: