From f0c0a93377bd75fc7f79590d898e55f5d31c2c08 Mon Sep 17 00:00:00 2001 From: jmcgill298 Date: Wed, 21 Apr 2021 16:35:27 -0400 Subject: [PATCH] Revert compiling GitCommand shell messages --- git/compat.py | 4 ++-- git/exc.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/git/compat.py b/git/compat.py index a0aea1ac4..c9b83ba46 100644 --- a/git/compat.py +++ b/git/compat.py @@ -18,7 +18,7 @@ # typing -------------------------------------------------------------------- -from typing import Any, AnyStr, Dict, Optional, Type +from typing import IO, Any, AnyStr, Dict, Optional, Type, Union from git.types import TBD # --------------------------------------------------------------------------- @@ -30,7 +30,7 @@ defenc = sys.getfilesystemencoding() -def safe_decode(s: Optional[AnyStr]) -> Optional[str]: +def safe_decode(s: Union[IO[str], AnyStr, None]) -> Optional[str]: """Safely decodes a binary string to unicode""" if isinstance(s, str): return s diff --git a/git/exc.py b/git/exc.py index c066e5e2f..358e7ae46 100644 --- a/git/exc.py +++ b/git/exc.py @@ -65,10 +65,12 @@ def __init__(self, command: Union[List[str], Tuple[str, ...], str], status = "'%s'" % s if isinstance(status, str) else s self._cmd = safe_decode(command[0]) - self._cmdline = ' '.join(str(safe_decode(i)) for i in command) + self._cmdline = ' '.join(safe_decode(i) for i in command) self._cause = status and " due to: %s" % status or "!" - self.stdout = stdout and "\n stdout: '%s'" % safe_decode(str(stdout)) or '' - self.stderr = stderr and "\n stderr: '%s'" % safe_decode(str(stderr)) or '' + stdout_decode = safe_decode(stdout) + stderr_decode = safe_decode(stderr) + self.stdout = stdout_decode and "\n stdout: '%s'" % stdout_decode or '' + self.stderr = stderr_decode and "\n stderr: '%s'" % stderr_decode or '' def __str__(self) -> str: return (self._msg + "\n cmdline: %s%s%s") % ( pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy