App.os_release: cat os-release non-interactively

Even with --interactive=[true|auto], there's no point in trying to
read /etc/os-release interactively, so don't do that. Most notably,
this commit keeps the property method from spilling /etc/os-release's
content over the terminal.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-03-23 10:09:30 +01:00
commit 8280327602

View file

@ -18,6 +18,7 @@ from enum import Enum, auto
from .lib.App import App as Base
from .lib.log import *
from .lib.Distro import Distro
from .lib.ExecContext import InputMode
# Meaning of pkg.requires.xxx variables
# build: needs to be built and installed before this can be built
@ -299,7 +300,13 @@ class App(Base):
@property
def os_release(self) -> str:
if self.__os_release is None:
result = self.call_async(self.exec_context.run(['/usr/bin/cat', '/etc/os-release'], throw=True))
result = self.call_async(
self.exec_context.run(
['/usr/bin/cat', '/etc/os-release'],
throw=True,
cmd_input=InputMode.NonInteractive
)
)
assert result.status == 0
self.__os_release = result.decode().stdout.strip()
return self.__os_release