Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions runas_others.go
Original file line number Diff line number Diff line change
@@ -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")
}
4 changes: 2 additions & 2 deletions runas.go → runas_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}