diff --git a/gef.py b/gef.py index d8b4adcad..20cea2914 100644 --- a/gef.py +++ b/gef.py @@ -3899,17 +3899,12 @@ def get_memory_alignment(in_bits: bool = False) -> int: def clear_screen(tty: str = "") -> None: """Clear the screen.""" global gef - if not tty: - cmd: str = gef.config["gef.clear_screen_command"] - gdb.execute(f"shell {cmd}") - return - # Since the tty can be closed at any time, a PermissionError exception can - # occur when `clear_screen` is called. We handle this scenario properly try: - with open(tty, "wt") as f: - f.write("\x1b[H\x1b[J") + sys.stdout.write("\x1b[H\x1b[J") except PermissionError: + # Since the tty can be closed at any time, a PermissionError exception can + # occur when `clear_screen` is called. We handle this scenario properly gef.ui.redirect_fd = None gef.config["context.redirect"] = "" return @@ -9945,7 +9940,6 @@ def __init__(self) -> None: gef.config["gef.libc_version"] = GefSetting("", str, "Specify libc version when auto-detection fails") gef.config["gef.main_arena_offset"] = GefSetting("", str, "Offset from libc base address to main_arena symbol (int or hex). Set to empty string to disable.") gef.config["gef.propagate_debug_exception"] = GefSetting(False, bool, "If true, when debug mode is enabled, Python exceptions will be propagated all the way.") - gef.config["gef.clear_screen_command"] = GefSetting("clear -x", str, "Command to use to clear the screen.") self.commands : Dict[str, GenericCommand] = collections.OrderedDict() self.functions : Dict[str, GenericFunction] = collections.OrderedDict()