From 16b043f50801c9b87da7e1c4eef61ddacc988ac1 Mon Sep 17 00:00:00 2001 From: Qubasa Date: Wed, 10 Jan 2024 20:52:14 +0100 Subject: [PATCH] cmd.py: Fixing bug: missing output because of forgotten flush() call --- pkgs/clan-cli/clan_cli/cmd.py | 2 ++ pkgs/clan-cli/clan_cli/machines/machines.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/clan-cli/clan_cli/cmd.py b/pkgs/clan-cli/clan_cli/cmd.py index 501ddfec..16a4a0fa 100644 --- a/pkgs/clan-cli/clan_cli/cmd.py +++ b/pkgs/clan-cli/clan_cli/cmd.py @@ -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") diff --git a/pkgs/clan-cli/clan_cli/machines/machines.py b/pkgs/clan-cli/clan_cli/machines/machines.py index e640967d..d8bd0be1 100644 --- a/pkgs/clan-cli/clan_cli/machines/machines.py +++ b/pkgs/clan-cli/clan_cli/machines/machines.py @@ -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", )