File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 13
13
import traceback
14
14
import time
15
15
import gc
16
+ import subprocess
16
17
from src .trackersetup import tracker_class_map , api_trackers , other_api_trackers , http_trackers
17
18
from src .trackerhandle import process_trackers
18
19
from src .queuemanage import handle_queue
@@ -289,12 +290,14 @@ async def save_processed_file(log_file, file_path):
289
290
290
291
def reset_terminal ():
291
292
"""Reset the terminal to a sane state."""
292
- if os .name == "posix" :
293
+ if os .name == "posix" and sys . stdin . isatty () :
293
294
try :
294
- if sys .stdin and sys .stdin .fileno () >= 0 and sys .stdin .isatty ():
295
- os .system ("stty sane" )
296
- except (ValueError , OSError ):
297
- pass
295
+ subprocess .run (["stty" , "sane" ], check = True )
296
+ except (subprocess .CalledProcessError , FileNotFoundError ):
297
+ try :
298
+ subprocess .run (["reset" ], check = True ) # Fallback if stty is unavailable
299
+ except (subprocess .CalledProcessError , FileNotFoundError ):
300
+ pass
298
301
299
302
300
303
async def do_the_thing (base_dir ):
You can’t perform that action at this time.
0 commit comments