sudo
Run direct commands or block-scoped operations with elevated privileges via
sudo.
Functions
run cmd *args … -> nil
Runs a verbatim command through sudo.
Parameters
| Name | Type | Description |
|---|---|---|
cmd |
Program to run. | |
:user? |
Str |
Account to use instead of root. |
:cd? |
(Str | fs.Path) |
Working directory requested via sudo. |
:env? |
Dict[Str | Sym, Value] |
Environment requested via sudo policy. |
*args |
Arguments passed verbatim to cmd. |
Example
with[R] func … -> R
Runs a block with elevated privileges through sudo.
Filesystem access and spawned programs use a temporary elevated VFS for the
duration of the block. Pass user to run as an account other than root.
Parameters
| Name | Type | Description |
|---|---|---|
func |
(() -> R) |
Block to run. |
:user? |
Str |
Account to use instead of root. |
:cd? |
(Str | fs.Path) |
Initial elevated directory. |
:env? |
Dict[Str | Sym, Value] |
Initial environment overrides. |