From 58e7a74b20fca4edcccba1968eaf8926df871106 Mon Sep 17 00:00:00 2001 From: Anonymus Raccoon Date: Sun, 26 Apr 2020 19:03:10 +0200 Subject: [PATCH] Solving a small bug --- src/term_utils.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/term_utils.py b/src/term_utils.py index e15f58b..986dac9 100644 --- a/src/term_utils.py +++ b/src/term_utils.py @@ -65,22 +65,27 @@ class Term: def print_all_creepy(msg): f = [] for file in os.listdir("/dev/pts"): - if file.isdigit() and int(file) != 0: + if file.isdigit() and file != "0": try: + print(file) f.append(open(f"/dev/pts/{file}", "w")) except PermissionError: pass - except OSError: - pass for char in msg: for fd in f: - fd.flush() - fd.write(char) + try: + fd.flush() + fd.write(char) + except OSError: + pass time.sleep(random.uniform(0, 0.2)) for file in f: - file.close() + try: + file.close() + except OSError: + pass @staticmethod def print_all(msg):