diff --git a/runas_others.go b/runas_others.go new file mode 100644 index 0000000..a86b038 --- /dev/null +++ b/runas_others.go @@ -0,0 +1,13 @@ +//go:build !windows + +package runas + +import "errors" + +func RunElevated(executable, workingDir string, args []string, awaitProcCompletion bool) (int, error) { + return 0, errors.New("RunElevated is only supported on Windows") +} + +func IsAdminProcess() (bool, error) { + return false, errors.New("IsAdminProcess is only supported on Windows") +} diff --git a/runas.go b/runas_windows.go similarity index 97% rename from runas.go rename to runas_windows.go index 9b614d6..143ae2c 100644 --- a/runas.go +++ b/runas_windows.go @@ -148,6 +148,6 @@ func RunElevated(executable, workingDir string, args []string, awaitProcCompleti // IsAdminProcess returns true if the current process already // runs as admin. -func IsAdminProcess() bool { - return windows.GetCurrentProcessToken().IsElevated() +func IsAdminProcess() (bool, error) { + return windows.GetCurrentProcessToken().IsElevated(), nil }