checkRoot ensures the command is run as root (Unix) or Administrator (Windows)
()
| 130 | |
| 131 | // checkRoot ensures the command is run as root (Unix) or Administrator (Windows) |
| 132 | func checkRoot() error { |
| 133 | if runtime.GOOS == "windows" { |
| 134 | // On Windows, admin check is done at install time; agent runs as Administrator |
| 135 | return nil |
| 136 | } |
| 137 | if os.Geteuid() != 0 { |
| 138 | return fmt.Errorf("this command requires root privileges, please run with sudo or as root user") |
| 139 | } |
| 140 | return nil |
| 141 | } |
no outgoing calls
no test coverage detected