vms: support secrets and fix cross compilation

This commit is contained in:
lassulus
2023-10-04 18:01:50 +02:00
parent 994c190d0f
commit bc36ec4c1a
4 changed files with 47 additions and 8 deletions

View File

@@ -8,7 +8,7 @@ import sys
import threading
import traceback
from enum import Enum
from typing import Any, Iterator, Type, TypeVar
from typing import Any, Iterator, Optional, Type, TypeVar
from uuid import UUID, uuid4
from .errors import ClanError
@@ -30,7 +30,7 @@ class Command:
self._output.put(None)
self.done = True
def run(self, cmd: list[str]) -> None:
def run(self, cmd: list[str], env: Optional[dict[str, str]] = None) -> None:
self.running = True
self.log.debug(f"Running command: {shlex.join(cmd)}")
self.p = subprocess.Popen(
@@ -38,6 +38,7 @@ class Command:
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf-8",
env=env,
)
assert self.p.stdout is not None and self.p.stderr is not None
os.set_blocking(self.p.stdout.fileno(), False)