Michael-cd30 commented on issue #14813:
URL: https://github.com/apache/airflow/issues/14813#issuecomment-1918745838

   SubprocessHook().run_command() has a limited number of parameters, for 
exemple "shell" is missing.
   
   You can instead write your own "run" function and send output to 
logger.getLogger("airflow.task").
   
   I've written this one to meet my needs.
   
   ```
   def check_call(command: str, env: dict = None) -> None:
   
       logger = logging.getLogger("airflow.task")
       logger.info(command)
   
       p = subprocess.Popen(
           command,
           text = True,
           shell = True,
           stdout = subprocess.PIPE,
           stderr = subprocess.PIPE,
           env = env
       )
   
       for line in p.stdout:
           logger.info(line)
   
       exit_code = p.wait()
   
       if exit_code:
           raise subprocess.CalledProcessError(exit_code, command)
   ```


-- 
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