Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def start(self, stdout=subprocess.PIPE, stderr=subprocess.PIPE):
""" Merged copy paste from the inheritance chain with modified stdout/err behaviour """
if self.pre_start_check():
# Some other executor (or process) is running with same config:
raise AlreadyRunning(self)
if self.process is None:
command = self.command
if not self._shell:
command = self.command_parts
env = os.environ.copy()
env[ENV_UUID] = self._uuid
popen_kwargs = {
"shell": self._shell,
"stdin": subprocess.PIPE,
"stdout": stdout,
"stderr": stderr,
"universal_newlines": True,
"env": env,
}
if platform.system() != "Windows":
popen_kwargs["preexec_fn"] = os.setsid
self.process = subprocess.Popen(command, **popen_kwargs)
self._set_timeout()
self.wait_for(self.check_subprocess)
return self
"""
if self.pre_start_check():
# Some other executor (or process) is running with same config:
raise AlreadyRunning(self)
if self.process is None:
command = self.command
if not self._shell:
command = self.command_parts
if isinstance(self.stdio, (list, tuple)):
stdin, stdout, stderr = self.stdio
else:
stdin = stdout = stderr = self.stdio
env = os.environ.copy()
env[ENV_UUID] = self._uuid
popen_kwargs = {
"shell": self._shell,
"stdin": stdin,
"stdout": stdout,
"stderr": stderr,
"universal_newlines": True,
"env": env,
"cwd": self.cwd,
}
if platform.system() != "Windows":
popen_kwargs["preexec_fn"] = os.setsid
self.process = subprocess.Popen(command, **popen_kwargs)
self._set_timeout()
try: