withPrivileges method Null safety
- RunPrivileged action,
- {bool allowUnprivileged = false}
Run action
with root UID and gid
Implementation
void withPrivileges(RunPrivileged action, {bool allowUnprivileged = false}) {
if (!allowUnprivileged && !Shell.current.isPrivilegedUser) {
throw ShellException(
'You can only use withPrivileges when running as a privileged user.',
);
}
action();
}