mirror of
https://github.com/jtesta/ssh-audit.git
synced 2026-05-25 15:31:23 +02:00
Modified OutputBuffer to have an error function to output to stderr. Change .fail with errors to .error
This commit is contained in:
@@ -54,6 +54,14 @@ class OutputBuffer:
|
||||
self.__is_color_supported = ('colorama' in sys.modules) or (os.name == 'posix')
|
||||
self.line_ended = True
|
||||
|
||||
def error(self, msg, line_ended=True):
|
||||
"""
|
||||
Writes an error message to stderr.
|
||||
"""
|
||||
end = '' if line_ended else '\n'
|
||||
sys.stderr.write(f'{msg}{end}')
|
||||
sys.stderr.flush()
|
||||
|
||||
def _print(self, level: str, s: str = '', line_ended: bool = True) -> None:
|
||||
'''Saves output to buffer (if in buffered mode), or immediately prints to stdout otherwise.'''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user