Don't suppress messages when logging is not configured by EliahKagan · Pull Request #1813 · gitpython-developers/GitPython
log = logging.getLogger(__name__) log.addHandler(logging.NullHandler()) _logger = logging.getLogger(__name__)
__all__ = ("Git",)
except Exception as ex: log.error(f"Pumping {name!r} of cmd({remove_password_if_present(cmdline)}) failed due to: {ex!r}") _logger.error(f"Pumping {name!r} of cmd({remove_password_if_present(cmdline)}) failed due to: {ex!r}") if "I/O operation on closed file" not in str(ex): # Only reraise if the error was not due to the stream closing raise CommandError([f"<{name}-pump>"] + remove_password_if_present(cmdline), ex) from ex
# It can be that nothing really exists anymore... if os is None or getattr(os, "kill", None) is None:
self.status = self._status_code_if_terminate or status except OSError as ex: log.info("Ignored error after process had died: %r", ex) _logger.info("Ignored error after process had died: %r", ex) # END exception handling
def __del__(self) -> None:
if status != 0: errstr = read_all_from_possibly_closed_stream(p_stderr) log.debug("AutoInterrupt wait stderr: %r" % (errstr,)) _logger.debug("AutoInterrupt wait stderr: %r" % (errstr,)) raise GitCommandError(remove_password_if_present(self.args), status, errstr) return status
# Allow the user to have the command executed in their working dir. try:
if stderr_value: log.info( _logger.info( "%s -> %d; stdout: '%s'; stderr: '%s'", cmdstr, status, as_text(stdout_value), safe_decode(stderr_value), ) elif stdout_value: log.info("%s -> %d; stdout: '%s'", cmdstr, status, as_text(stdout_value)) _logger.info("%s -> %d; stdout: '%s'", cmdstr, status, as_text(stdout_value)) else: log.info("%s -> %d", cmdstr, status) _logger.info("%s -> %d", cmdstr, status) # END handle debug printing
if with_exceptions and status != 0: