1
0
forked from clan/clan-core

cmd.py: Fixing bug: missing output because of forgotten flush() call

This commit is contained in:
Luis Hebendanz 2024-01-10 20:52:14 +01:00
parent 0133ccd5f7
commit 16b043f508
2 changed files with 4 additions and 1 deletions

View File

@ -38,12 +38,14 @@ def handle_output(process: subprocess.Popen, log: Log) -> tuple[str, str]:
ret = handle_fd(process.stdout)
if log in [Log.STDOUT, Log.BOTH]:
sys.stdout.buffer.write(ret)
sys.stdout.flush()
stdout_buf += ret
ret = handle_fd(process.stderr)
if log in [Log.STDERR, Log.BOTH]:
sys.stderr.buffer.write(ret)
sys.stderr.flush()
stderr_buf += ret
return stdout_buf.decode("utf-8"), stderr_buf.decode("utf-8")

View File

@ -3,7 +3,7 @@ import os
import sys
from pathlib import Path
from ..cmd import run
from ..cmd import Log, run
from ..nix import nix_build, nix_config, nix_eval
from ..ssh import Host, parse_deployment_address
@ -18,6 +18,7 @@ def build_machine_data(machine_name: str, clan_dir: Path) -> dict:
f'{clan_dir}#clanInternals.machines."{system}"."{machine_name}".config.system.clan.deployment.file'
]
),
log=Log.BOTH,
error_msg="failed to build machine data",
)