ashb closed pull request #3799: [AIRFLOW-2665] Use shlex to split args and 
remove shell true
URL: https://github.com/apache/incubator-airflow/pull/3799
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/executors/local_executor.py 
b/airflow/executors/local_executor.py
index 291d6e1277..2212933f66 100644
--- a/airflow/executors/local_executor.py
+++ b/airflow/executors/local_executor.py
@@ -46,8 +46,10 @@
 
 import multiprocessing
 import subprocess
+import shlex
 import time
 
+
 from builtins import range
 
 from airflow.executors.base_executor import BaseExecutor
@@ -82,8 +84,11 @@ def execute_work(self, key, command):
         if key is None:
             return
         self.log.info("%s running %s", self.__class__.__name__, command)
+        if isinstance(command, list):
+            command = " ".join(command)
+        args = shlex.split(command)
         try:
-            subprocess.check_call(command, close_fds=True)
+            subprocess.check_call(args, close_fds=True)
             state = State.SUCCESS
         except subprocess.CalledProcessError as e:
             state = State.FAILED


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to