Skip to content

Commit

Permalink
Add option to disable buffering (#917)
Browse files Browse the repository at this point in the history
  • Loading branch information
clubby789 committed Nov 13, 2022
1 parent af63b4d commit 75c76fe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gef.py
Expand Up @@ -234,7 +234,7 @@ def highlight_text(text: str) -> str:
def gef_print(*args: str, end="\n", sep=" ", **kwargs: Any) -> None:
"""Wrapper around print(), using string buffering feature."""
parts = [highlight_text(a) for a in args]
if gef.ui.stream_buffer and not is_debug():
if buffer_output() and gef.ui.stream_buffer and not is_debug():
gef.ui.stream_buffer.write(sep.join(parts) + end)
return

Expand Down Expand Up @@ -1882,6 +1882,11 @@ def is_debug() -> bool:
return gef.config["gef.debug"] is True


def buffer_output() -> bool:
"""Check if output should be buffered until command completion."""
return gef.config["gef.buffer"] is True


def hide_context() -> bool:
"""Helper function to hide the context pane."""
gef.ui.context_hidden = True
Expand Down Expand Up @@ -9336,6 +9341,7 @@ def __init__(self) -> None:
gef.config["gef.disable_color"] = GefSetting(False, bool, "Disable all colors in GEF")
gef.config["gef.tempdir"] = GefSetting(GEF_TEMP_DIR, str, "Directory to use for temporary/cache content")
gef.config["gef.show_deprecation_warnings"] = GefSetting(True, bool, "Toggle the display of the `deprecated` warnings")
gef.config["gef.buffer"] = GefSetting(True, bool, "Internally buffer command output until completion")

self.commands : Dict[str, GenericCommand] = collections.OrderedDict()
self.functions : Dict[str, GenericFunction] = collections.OrderedDict()
Expand Down

0 comments on commit 75c76fe

Please sign in to comment.