mirror of
https://github.com/astral-sh/ty.git
synced 2026-05-06 08:56:48 -04:00
f906491c4d
Closes https://github.com/astral-sh/ruff/issues/18153 Copy of https://github.com/astral-sh/ruff/pull/23406
28 lines
520 B
Python
28 lines
520 B
Python
from __future__ import annotations
|
|
|
|
import os
|
|
import sys
|
|
|
|
from ty import find_ty_bin
|
|
|
|
|
|
def _run() -> None:
|
|
ty = find_ty_bin()
|
|
|
|
if sys.platform == "win32":
|
|
import subprocess
|
|
|
|
# Avoid emitting a traceback on interrupt
|
|
try:
|
|
completed_process = subprocess.run([ty, *sys.argv[1:]])
|
|
except KeyboardInterrupt:
|
|
sys.exit(2)
|
|
|
|
sys.exit(completed_process.returncode)
|
|
else:
|
|
os.execvp(ty, [ty, *sys.argv[1:]])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
_run()
|