This commit is contained in:
Maxim Devaev 2022-06-19 20:42:52 +03:00
parent 4aa7a21b55
commit 0edf854832
2 changed files with 6 additions and 1 deletions

View File

@ -38,7 +38,7 @@ async def remount(name: str, base_cmd: List[str], rw: bool) -> bool:
part.format(mode=mode) part.format(mode=mode)
for part in base_cmd for part in base_cmd
] ]
logger.info("Remounting %s storage to %s: %s ...", name, mode.upper(), cmd) logger.info("Remounting %s storage to %s: %s ...", name, mode.upper(), tools.cmdfmt(cmd))
try: try:
proc = await aioproc.log_process(cmd, logger) proc = await aioproc.log_process(cmd, logger)
if proc.returncode != 0: if proc.returncode != 0:

View File

@ -24,6 +24,7 @@ import operator
import functools import functools
import multiprocessing.queues import multiprocessing.queues
import queue import queue
import shlex
from typing import Tuple from typing import Tuple
from typing import List from typing import List
@ -38,6 +39,10 @@ def remap(value: int, in_min: int, in_max: int, out_min: int, out_max: int) -> i
# ===== # =====
def cmdfmt(cmd: List[str]) -> str:
return " ".join(map(shlex.quote, cmd))
def efmt(err: Exception) -> str: def efmt(err: Exception) -> str:
return f"{type(err).__name__}: {err}" return f"{type(err).__name__}: {err}"