fix: Improve user input handling for y/N prompt in CLI

This commit is contained in:
2025-01-03 13:47:57 +01:00
parent 3cbb749655
commit d4f96d72d8

View File

@@ -246,6 +246,8 @@ def main():
if not args.yes:
try:
# Check if running in a terminal
if sys.stdin.isatty():
import tty
import termios
@@ -265,8 +267,13 @@ def main():
finally:
# Restore terminal settings
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
else:
# If not in a terminal, use regular input
sys.stdout.write("\nDo you want to proceed with getting the summary? (y/N): ")
sys.stdout.flush()
char = input().strip()
if char.lower() != "y":
if not char or char.lower() != "y":
print("Operation cancelled by user.")
cleanup_files(vtt_path)
sys.exit(0)