Relaunch through UAC when (un)installing the service unprivileged
--install-service/--remove-service on Windows no longer fail with 'Access is denied' from a normal shell: the process re-runs itself via ShellExecuteEx 'runas', waits for the elevated child and mirrors its exit code. The child gets --elevated-child and pauses for a keypress so its console output stays readable. Declining the prompt reports 'UAC prompt declined'.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package service
|
||||
|
||||
import "errors"
|
||||
|
||||
// ErrUserCancelled is returned by RelaunchElevated when the user declines
|
||||
// the UAC prompt. Windows-only in practice; defined here so cross-platform
|
||||
// callers can compare against it.
|
||||
var ErrUserCancelled = errors.New("UAC prompt declined")
|
||||
Reference in New Issue
Block a user