(cmd)
| 158 | |
| 159 | |
| 160 | def command_exists(cmd): |
| 161 | if sys.platform == "win32": |
| 162 | safe_cmd = shlex.split(f'{cmd}') |
| 163 | result = subprocess.Popen(safe_cmd, stdout=subprocess.PIPE) |
| 164 | return result.wait() == 1 |
| 165 | else: |
| 166 | safe_cmd = shlex.split(f"bash -c type {cmd}") |
| 167 | result = subprocess.Popen(safe_cmd, stdout=subprocess.PIPE) |
| 168 | return result.wait() == 0 |
| 169 | |
| 170 | |
| 171 | def op_envvar(op_name): |