mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
cmdfmt
This commit is contained in:
parent
4aa7a21b55
commit
0edf854832
@ -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:
|
||||||
|
|||||||
@ -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}"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user