FIXME: helpers: run: handle Arch in cmd (MR 2252)

We need a better solution here.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-09 08:01:27 +02:00 committed by Oliver Smith
parent 53a2953a4a
commit aba3584b02
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -3,6 +3,7 @@
import os
from pathlib import Path
import subprocess
from pmb.core.arch import Arch
import pmb.helpers.run_core
from typing import Any, Dict, List, Optional, Sequence
from pmb.types import Env, PathString, PmbArgs
@ -19,7 +20,13 @@ def user(cmd: Sequence[PathString], working_dir: Optional[Path] = None, output:
See pmb.helpers.run_core.core() for a detailed description of all other
arguments and the return value.
"""
cmd_parts = [os.fspath(x) for x in cmd]
cmd_parts = []
for c in cmd:
if isinstance(c, Arch):
c = str(c)
else:
c = os.fspath(c)
cmd_parts.append(c)
# Readable log message (without all the escaping)
msg = "% "
for key, value in env.items():