fix: processes in docker images and pass full environment to

subprocesses

Since 1.0.4 release devtools require systemd to be run in order to
create slice for unit
This commit is contained in:
2023-09-28 15:17:20 +03:00
parent 462096ee8a
commit d5f4fc9b86
6 changed files with 27 additions and 4 deletions

View File

@ -125,11 +125,14 @@ def check_output(*args: str, exception: Exception | Callable[[int, list[str], st
yield key.data, line
# build system environment based on args and current environment
environment = environment or {}
if user is not None:
environment["HOME"] = getpwuid(user).pw_dir
full_environment = os.environ | environment
with subprocess.Popen(args, cwd=cwd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
user=user, env=environment, text=True, encoding="utf8", bufsize=1) as process:
user=user, env=full_environment, text=True, encoding="utf8", bufsize=1) as process:
if input_data is not None:
input_channel = get_io(process, "stdin")
input_channel.write(input_data)