withPrivileges method
Run privilegedCallback
with root UID and gid
Implementation
void withPrivileges(RunPrivileged privilegedCallback) {
if (!Shell.current.isPrivilegedUser) {
throw ShellException(
'You can only use withPrivileges when running as a privileged user.');
}
privilegedCallback();
}