-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_tui_safe.py
More file actions
executable file
·41 lines (30 loc) · 914 Bytes
/
Copy pathtest_tui_safe.py
File metadata and controls
executable file
·41 lines (30 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python3
"""Safe TUI test script with proper cleanup"""
import signal
import sys
from pathlib import Path
# Add src to path
sys.path.insert(0, str(Path(__file__).parent / "src"))
from eyelet.tui.app import EyeletApp
def cleanup_terminal():
"""Clean up terminal state"""
import os
# Reset terminal modes
os.system('printf "\\033[?1000l\\033[?1003l\\033[?1015l\\033[?1006l"')
os.system('printf "\\033[?1049l\\033[?25h\\033[0m"')
os.system("stty sane")
def signal_handler(signum, frame):
"""Handle signals and cleanup"""
cleanup_terminal()
sys.exit(0)
if __name__ == "__main__":
# Set up signal handlers
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
try:
app = EyeletApp()
app.run()
except Exception as e:
print(f"Error: {e}")
finally:
cleanup_terminal()