ExecContext: Fix output handling #9
2 changed files with 2 additions and 2 deletions
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 <jan@janware.com>
commit
4a6c8ab1d1
|
|
@ -78,7 +78,7 @@ class Distro(abc.ABC):
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
raise
|
raise
|
||||||
uname = result.stdout_str.lower()
|
uname = result.stdout_str.strip().lower()
|
||||||
ret = f'ID={uname}\nVERSION_CODENAME=unknown'
|
ret = f'ID={uname}\nVERSION_CODENAME=unknown'
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -588,7 +588,7 @@ class ExecContext(Base):
|
||||||
raise Exception(
|
raise Exception(
|
||||||
f'Failed to create temporary file on {self.root}: {result.summary}'
|
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:
|
async def _stat(self, path: str, follow_symlinks: bool) -> StatResult:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue