Identified deadlocking funciton

This commit is contained in:
Qubasa
2024-01-11 22:28:35 +01:00
parent a98463e3b9
commit 2c6c4bacce
2 changed files with 9 additions and 6 deletions

View File

@@ -72,7 +72,7 @@ def run(
) )
stdout_buf, stderr_buf = handle_output(process, log) stdout_buf, stderr_buf = handle_output(process, log)
# stdout_buf, stderr_buf = process.communicate()
# Wait for the subprocess to finish # Wait for the subprocess to finish
rc = process.wait() rc = process.wait()
cmd_out = CmdOut( cmd_out = CmdOut(

View File

@@ -1,9 +1,11 @@
import argparse import argparse
import logging import logging
import os import os
import subprocess
import sys import sys
from ..cmd import Log, run from clan_cli.errors import ClanError
from ..machines.machines import Machine from ..machines.machines import Machine
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@@ -15,13 +17,14 @@ def generate_secrets(machine: Machine) -> None:
env["PYTHONPATH"] = ":".join(sys.path) # TODO do this in the clanCore module env["PYTHONPATH"] = ":".join(sys.path) # TODO do this in the clanCore module
print(f"generating secrets... {machine.generate_secrets}") print(f"generating secrets... {machine.generate_secrets}")
run( proc = subprocess.run(
[machine.generate_secrets], [machine.generate_secrets],
env=env, env=env,
error_msg="failed to generate secrets",
log=Log.BOTH,
) )
if proc.returncode != 0:
raise ClanError("failed to generate secrets")
else:
print("successfully generated secrets") print("successfully generated secrets")