(self, args, env: Optional[Dict]=None)
| 1107 | |
| 1108 | # This function can only be used to execute commands that return ASCII-only output, otherwise the decoding will fail |
| 1109 | def _run_args(self, args, env: Optional[Dict]=None): |
| 1110 | si = None |
| 1111 | if sys.platform == "win32": |
| 1112 | si = subprocess.STARTUPINFO() |
| 1113 | si.dwFlags |= subprocess.STARTF_USESHOWWINDOW |
| 1114 | |
| 1115 | try: |
| 1116 | return (True, subprocess.check_output(args, startupinfo=si, stderr=subprocess.STDOUT, env=env).decode("utf-8")) |
| 1117 | except subprocess.SubprocessError as se: |
| 1118 | return (False, str(se)) |
| 1119 | |
| 1120 | def _pip_exists(self, python_bin: str, python_env: Optional[Dict]=None) -> bool: |
| 1121 | return self._run_args([python_bin, "-c", "import pip; pip.__version__"], env=python_env)[0] |
no test coverage detected