|
16 | 16 | import os |
17 | 17 | import re |
18 | 18 | import shutil |
19 | | -import shlex |
20 | 19 | import subprocess |
21 | 20 | import sys |
22 | 21 | import tempfile |
@@ -59,47 +58,6 @@ def ensure_default_files(): |
59 | 58 | "SNOWFLAKE_ROLE", |
60 | 59 | ] |
61 | 60 |
|
62 | | - |
63 | | -def relaunch_in_terminal() -> bool: |
64 | | - """Relaunch this script in a terminal window. |
65 | | -
|
66 | | - Prefers Ghostty when available on macOS or Linux. Falls back to the |
67 | | - default system terminal when Ghostty isn't installed. Returns True if a |
68 | | - new terminal was spawned and the caller should exit.""" |
69 | | - |
70 | | - if os.environ.get("VICTORIA_IN_TERMINAL"): |
71 | | - return False |
72 | | - |
73 | | - cmd: List[str] = [sys.executable, str(Path(__file__).resolve())] + sys.argv[1:] |
74 | | - env = os.environ.copy() |
75 | | - env["VICTORIA_IN_TERMINAL"] = "1" |
76 | | - |
77 | | - ghostty = shutil.which("ghostty") |
78 | | - if ghostty and sys.platform != "win32": |
79 | | - try: |
80 | | - subprocess.Popen([ghostty, "-e", *cmd], env=env) |
81 | | - return True |
82 | | - except Exception: |
83 | | - pass |
84 | | - |
85 | | - if sys.platform == "darwin": |
86 | | - try: |
87 | | - osa_cmd = f'tell application "Terminal" to do script "{shlex.join(cmd)}"' |
88 | | - subprocess.Popen(["osascript", "-e", osa_cmd], env=env) |
89 | | - return True |
90 | | - except Exception: |
91 | | - pass |
92 | | - elif sys.platform.startswith("linux"): |
93 | | - term = shutil.which("x-terminal-emulator") |
94 | | - if term: |
95 | | - try: |
96 | | - subprocess.Popen([term, "-e", *cmd], env=env) |
97 | | - return True |
98 | | - except Exception: |
99 | | - pass |
100 | | - |
101 | | - return False |
102 | | - |
103 | 61 | # ------------------ Terminal Capability Detection ------------------ |
104 | 62 | def _enable_windows_ansi(): |
105 | 63 | """Best-effort enable ANSI on Windows without external deps.""" |
@@ -819,8 +777,6 @@ def main(): |
819 | 777 | launch_tool() |
820 | 778 |
|
821 | 779 | if __name__ == "__main__": |
822 | | - if relaunch_in_terminal(): |
823 | | - sys.exit(0) |
824 | 780 | try: |
825 | 781 | main() |
826 | 782 | except KeyboardInterrupt: |
|
0 commit comments