diff --git a/craft_parts/errors.py b/craft_parts/errors.py index b31196fdf..18008c7cc 100644 --- a/craft_parts/errors.py +++ b/craft_parts/errors.py @@ -518,9 +518,9 @@ def details(self) -> str | None: Discards all trace lines that come before the last-executed script line """ + if self.stderr is None: + return super().details with contextlib.closing(StringIO()) as details_io: - if self.stderr is None: - return None stderr = self.stderr.decode("utf-8", errors="replace") details_io.write("\nCaptured standard error:")