uranusjr commented on code in PR #40942:
URL: https://github.com/apache/airflow/pull/40942#discussion_r1687830888


##########
airflow/utils/process_utils.py:
##########
@@ -162,14 +162,17 @@ def signal_procs(sig):
     return returncodes
 
 
-def execute_in_subprocess(cmd: list[str], cwd: str | None = None) -> None:
+def execute_in_subprocess(cmd: list[str], cwd: str | None = None, env_vars: 
dict | None = None) -> None:
     """
     Execute a process and stream output to logger.
 
     :param cmd: command and arguments to run
     :param cwd: Current working directory passed to the Popen constructor
+    :param env_vars: Additional environment variables to set for the 
subprocess. If None,
+        the subprocess will inherit the current environment variables of the 
parent process
+        (``os.environ``)
     """
-    execute_in_subprocess_with_kwargs(cmd, cwd=cwd)
+    execute_in_subprocess_with_kwargs(cmd, cwd=cwd, env=dict(os.environ, 
**env_vars) if env_vars else None)

Review Comment:
   Should we also have a way for users to not overlay `env_vars`, but instead 
overwrite instead?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to