withPrivileges method

  1. @override
void withPrivileges(
  1. RunPrivileged privilegedCallback
)
override

When a script is run under sudo on Linux and osx and you have previously called releasePrivileges then this method will run privilegedCallback with root privileges.

If you attempt to call withPrivileges when not running as a privileged process a ShellException will be thrown.

Use isPrivilegedProcess to check if your script was started as a priviliged process.

Nesting withPrivileges blocks is allowed as a convenience.

You must NEVER call releasePrivileges within a withPrivileges callback.

Implementation

@override
void withPrivileges(RunPrivileged privilegedCallback) {
  throw UnimplementedError();
}