From c878bee721fcf95108538d5cd3bfa12c4eea3ed1 Mon Sep 17 00:00:00 2001
From: Anonymus Raccoon
Date: Sat, 25 Apr 2020 17:29:54 +0200
Subject: [PATCH] Making the print function return a success bool
---
term_utils.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/term_utils.py b/term_utils.py
index 9ba5466..efaa64b 100644
--- a/term_utils.py
+++ b/term_utils.py
@@ -37,8 +37,12 @@ class Term:
time.sleep(1)
def print(self, msg):
- with open(self.tty, "w") as file:
- file.write(msg)
+ try:
+ with open(self.tty, "w") as file:
+ file.write(msg)
+ return True
+ except PermissionError:
+ return False
def print_creepy(self, msg):
with open(self.tty, "w") as file: