You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by kp...@apache.org on 2022/07/01 19:00:49 UTC

[tvm] branch main updated: [Hexagon] Fix use of subprocess.run in _check_call_verbose (#11985)

This is an automated email from the ASF dual-hosted git repository.

kparzysz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new c97895e0ff [Hexagon] Fix use of subprocess.run in _check_call_verbose (#11985)
c97895e0ff is described below

commit c97895e0ffb512e73c89de7cdee9846f052244fc
Author: Krzysztof Parzyszek <kp...@quicinc.com>
AuthorDate: Fri Jul 1 14:00:43 2022 -0500

    [Hexagon] Fix use of subprocess.run in _check_call_verbose (#11985)
    
    It uses parameters that are not present in Python 3.6, plus it
    catches generic exception, which may not have `stdout` or `stderr`
    members.
---
 python/tvm/contrib/hexagon/build.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/python/tvm/contrib/hexagon/build.py b/python/tvm/contrib/hexagon/build.py
index 080b982877..fe7434f738 100644
--- a/python/tvm/contrib/hexagon/build.py
+++ b/python/tvm/contrib/hexagon/build.py
@@ -47,8 +47,15 @@ def _check_call_verbose(cmd, **kwargs) -> None:
     the stdout/stderr provided by the subprocess.
     """
     try:
-        subprocess.run(cmd, capture_output=True, check=True, text=True, **kwargs)
-    except Exception as err:
+        subprocess.run(
+            cmd,
+            check=True,
+            encoding="UTF-8",
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE,
+            **kwargs,
+        )
+    except subprocess.CalledProcessError as err:
         error_msg = f"{err}\nstdout:\n{err.stdout}\nstderr:\n{err.stderr}"
         raise Exception(error_msg)