Select a direct product launch or an explicit Windows shebang runner.
(binary: str)
| 32 | |
| 33 | |
| 34 | def mcp_command(binary: str) -> list[str]: |
| 35 | """Select a direct product launch or an explicit Windows shebang runner.""" |
| 36 | if os.name != "nt": |
| 37 | return [binary] |
| 38 | try: |
| 39 | with open(binary, "rb") as stream: |
| 40 | shebang = stream.read(2) == b"#!" |
| 41 | except OSError: |
| 42 | return [binary] |
| 43 | if not shebang: |
| 44 | return [binary] |
| 45 | bash = shutil.which("bash") |
| 46 | if not bash: |
| 47 | raise SmokeFailure("Windows shebang MCP fixture requires bash on PATH") |
| 48 | return [bash, binary] |
| 49 | |
| 50 | |
| 51 | def read_json_lines( |