Get the correct npx command for the current platform.
()
| 40 | |
| 41 | |
| 42 | def _get_npx_command(): |
| 43 | """Get the correct npx command for the current platform.""" |
| 44 | if sys.platform == "win32": |
| 45 | # Try both npx.cmd and npx.exe on Windows |
| 46 | for cmd in ["npx.cmd", "npx.exe", "npx"]: |
| 47 | try: |
| 48 | subprocess.run([cmd, "--version"], check=True, capture_output=True, shell=True) |
| 49 | return cmd |
| 50 | except subprocess.CalledProcessError: |
| 51 | continue |
| 52 | return None |
| 53 | return "npx" # On Unix-like systems, just use npx |
| 54 | |
| 55 | |
| 56 | def _parse_env_var(env_var: str) -> tuple[str, str]: # pragma: no cover |