fix: Improve user input handling for y/N prompt in CLI
This commit is contained in:
@@ -246,6 +246,8 @@ def main():
|
|||||||
|
|
||||||
if not args.yes:
|
if not args.yes:
|
||||||
try:
|
try:
|
||||||
|
# Check if running in a terminal
|
||||||
|
if sys.stdin.isatty():
|
||||||
import tty
|
import tty
|
||||||
import termios
|
import termios
|
||||||
|
|
||||||
@@ -265,8 +267,13 @@ def main():
|
|||||||
finally:
|
finally:
|
||||||
# Restore terminal settings
|
# Restore terminal settings
|
||||||
termios.tcsetattr(fd, termios.TCSADRAIN, old_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.")
|
print("Operation cancelled by user.")
|
||||||
cleanup_files(vtt_path)
|
cleanup_files(vtt_path)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user