新增RunAsAdmin方法

This commit is contained in:
zyj
2026-03-06 14:29:43 +08:00
parent f24f81e674
commit d567b7b80a
4 changed files with 239 additions and 0 deletions

View File

@@ -42,6 +42,11 @@ type Platform interface {
// InstallFont 安装字体
InstallFont(ctx context.Context, fontPath string) error
// RunAsAdmin 以管理员/root 权限运行命令
// Windows 上通过 UAC 对话框提升权限
// Linux/macOS 上通过 sudo 获取 root 权限
RunAsAdmin(ctx context.Context, name string, args ...string) error
}
// Detect 检测当前平台并返回对应的 Platform 实现