Update exec/control usage

This commit is contained in:
世界
2022-08-16 18:19:48 +08:00
parent c165969399
commit 835ae1217b
6 changed files with 38 additions and 56 deletions

View File

@@ -27,9 +27,9 @@ func init() {
func runAsUser(name string, args ...string) error {
if os.Getuid() != 0 {
return runCommand(name, args...)
return common.Exec(name, args...).Attach().Run()
} else if sudoUser != "" {
return runCommand("su", "-", sudoUser, "-c", F.ToString(name, " ", strings.Join(args, " ")))
return common.Exec("su", "-", sudoUser, "-c", F.ToString(name, " ", strings.Join(args, " "))).Attach().Run()
} else {
return E.New("set system proxy: unable to set as root")
}