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 |
(Str | fs.Path) |
Program to run. |
:user? |
Str |
Account to use instead of root. |
:cd? |
(Str | fs.Path) |
Working directory requested via sudo. |
:env? |
BaseDict[Str | Sym, Str | :INHERIT: | nil] |
Environment requested via sudo policy. |
*args |
Value |
Arguments passed verbatim to cmd. |
< |
Iter[Value] |
|
> |
Sink[Str] |
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? |
BaseDict[Str | Sym, Value] |
Initial environment overrides. |