Replace os.system() in clear_screen() with ANSI escape codes

- Eliminates shell injection risk from os.system('clear'/'cls')
- Uses ANSI escape sequence \033[H\033[2J instead
- Removed unused os import
- Added test verifying ANSI codes are used
This commit is contained in:
Aaron Boxer
2026-04-17 09:31:00 -04:00
parent 18bce1864a
commit a6147a6745
2 changed files with 8 additions and 3 deletions
+1 -2
View File
@@ -1,4 +1,3 @@
import os
import textwrap
import scipy
import numpy as np
@@ -8,7 +7,7 @@ from pathlib import Path
def clear_screen():
"""Clears the console screen."""
os.system("cls" if os.name == "nt" else "clear")
print("\033[H\033[2J", end="", flush=True)
def print_transcript(text, translated=False, timestamps=False):