You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/08/19 14:38:02 UTC

[GitHub] [airflow] deedmitrij commented on a change in pull request #17651: Create CMDExecutor for raising an exception in case of error during cmd execution

deedmitrij commented on a change in pull request #17651:
URL: https://github.com/apache/airflow/pull/17651#discussion_r692173240



##########
File path: tests/test_utils/logging_command_executor.py
##########
@@ -41,11 +41,13 @@ def execute_cmd(self, cmd, silent=False, cwd=None, env=None):
             ) as process:
                 output, err = process.communicate()
                 retcode = process.poll()
-                self.log.info("Stdout: %s", output)
-                self.log.info("Stderr: %s", err)
                 if retcode:
                     self.log.error("Error when executing %s", " ".join(shlex.quote(c) for c in cmd))
-                return retcode
+                    raise AirflowException(
+                        f"Retcode {retcode} for '{' '.join(cmd)}' with stdout: {output}, stderr: {err}"
+                    )

Review comment:
       Such part of code is existed already. I took it from there




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org