From 4a6c8ab1d1ed3c76c0cb5526c721ca9b7c10343e Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 10 Jun 2026 11:54:03 +0200 Subject: [PATCH] lib.ExecContext|.Distro: Ignore stdout_str newline Ignore newline at the end of Result.stdout_str if only one line of output is wanted from an executed shell command. The output of both uname and mktemp are used wrongly in that regard. Signed-off-by: Jan Lindemann --- src/python/jw/pkg/lib/Distro.py | 2 +- src/python/jw/pkg/lib/ExecContext.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/python/jw/pkg/lib/Distro.py b/src/python/jw/pkg/lib/Distro.py index 816423c8..76a01571 100644 --- a/src/python/jw/pkg/lib/Distro.py +++ b/src/python/jw/pkg/lib/Distro.py @@ -78,7 +78,7 @@ class Distro(abc.ABC): ), ) raise - uname = result.stdout_str.lower() + uname = result.stdout_str.strip().lower() ret = f'ID={uname}\nVERSION_CODENAME=unknown' return ret diff --git a/src/python/jw/pkg/lib/ExecContext.py b/src/python/jw/pkg/lib/ExecContext.py index c9058a46..fd08ccd5 100644 --- a/src/python/jw/pkg/lib/ExecContext.py +++ b/src/python/jw/pkg/lib/ExecContext.py @@ -588,7 +588,7 @@ class ExecContext(Base): raise Exception( f'Failed to create temporary file on {self.root}: {result.summary}' ) - return result.stdout_str + return result.stdout_str.strip() async def _stat(self, path: str, follow_symlinks: bool) -> StatResult: