admin
Query administrator privileges and elevate to them in a cross-platform manner.
Functions
query() -> Bool
Reports whether the active target has effective administrator privileges.
On Windows, this checks whether the access token is elevated. On Unix, it checks whether the effective user ID is zero.
with[R] block … -> R
Runs block with administrator privileges.
Windows uses UAC and Unix uses sudo. If the current context already has
administrator privileges, block runs directly.
Filesystem access and spawned programs use the elevated VFS for the duration of the block.
Parameters
| Name | Type | Description |
|---|---|---|
block |
(() -> R) |
Block to run. |
:cd? |
(Str | fs.Path) |
Initial working directory. |
:env? |
Dict[Str | Sym, Value] |
Initial environment overrides. |