forked from clan/clan-core
cmd.py: Fixing bug: missing output because of forgotten flush() call
This commit is contained in:
parent
0133ccd5f7
commit
16b043f508
@ -38,12 +38,14 @@ def handle_output(process: subprocess.Popen, log: Log) -> tuple[str, str]:
|
|||||||
ret = handle_fd(process.stdout)
|
ret = handle_fd(process.stdout)
|
||||||
if log in [Log.STDOUT, Log.BOTH]:
|
if log in [Log.STDOUT, Log.BOTH]:
|
||||||
sys.stdout.buffer.write(ret)
|
sys.stdout.buffer.write(ret)
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
stdout_buf += ret
|
stdout_buf += ret
|
||||||
ret = handle_fd(process.stderr)
|
ret = handle_fd(process.stderr)
|
||||||
|
|
||||||
if log in [Log.STDERR, Log.BOTH]:
|
if log in [Log.STDERR, Log.BOTH]:
|
||||||
sys.stderr.buffer.write(ret)
|
sys.stderr.buffer.write(ret)
|
||||||
|
sys.stderr.flush()
|
||||||
stderr_buf += ret
|
stderr_buf += ret
|
||||||
return stdout_buf.decode("utf-8"), stderr_buf.decode("utf-8")
|
return stdout_buf.decode("utf-8"), stderr_buf.decode("utf-8")
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from ..cmd import run
|
from ..cmd import Log, run
|
||||||
from ..nix import nix_build, nix_config, nix_eval
|
from ..nix import nix_build, nix_config, nix_eval
|
||||||
from ..ssh import Host, parse_deployment_address
|
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'
|
f'{clan_dir}#clanInternals.machines."{system}"."{machine_name}".config.system.clan.deployment.file'
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
log=Log.BOTH,
|
||||||
error_msg="failed to build machine data",
|
error_msg="failed to build machine data",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user