fix: 修复远程部署脚本命令解析

This commit is contained in:
Nixevol
2026-07-05 17:16:57 +08:00
parent b961223b09
commit 14e3ac2709
2 changed files with 15 additions and 2 deletions
+14 -2
View File
@@ -79,6 +79,14 @@ def ask_secret(prompt: str, default: str = "") -> str:
return value or default
def ask_required_secret(prompt: str) -> str:
while True:
value = getpass.getpass(f"{prompt}: ").strip()
if value:
return value
log("该项不能为空,请重新输入。")
def ask_yes_no(prompt: str, default: bool = True) -> bool:
hint = "Y/n" if default else "y/N"
value = input(f"{prompt}({hint}): ").strip().lower()
@@ -141,7 +149,7 @@ def ask_config() -> DeployConfig:
ssh_host = ask("服务器 SSH IP/域名")
ssh_port = int(ask("服务器 SSH 端口", "22"))
ssh_username = ask("服务器 SSH 账号", "root")
ssh_password = ask_secret("服务器 SSH 密码")
ssh_password = ask_required_secret("服务器 SSH 密码")
return DeployConfig(
admin_url=admin_url,
@@ -176,7 +184,11 @@ def ask_config() -> DeployConfig:
def run_cmd(args: list[str], cwd: Path | None = None) -> None:
log("$ " + " ".join(shlex.quote(str(item)) for item in args))
subprocess.run(args, cwd=str(cwd or ROOT), check=True)
resolved_args = args[:]
executable = shutil.which(resolved_args[0])
if executable:
resolved_args[0] = executable
subprocess.run(resolved_args, cwd=str(cwd or ROOT), check=True)
def remove_dir(path: Path) -> None: