diff --git a/git/cmd.py b/git/cmd.py index 0d2913678..3dd5aad33 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -546,7 +546,7 @@ def read_all_from_possibly_closed_stream(stream: Union[IO[bytes], None]) -> byte if stream: try: return stderr_b + force_bytes(stream.read()) - except ValueError: + except (OSError, ValueError): return stderr_b or b"" else: return stderr_b or b""