withPrivilegesAsync method

  1. @override
Future<void> withPrivilegesAsync(
  1. RunPrivilegedAsync action, {
  2. bool allowUnprivileged = false,
})
override

Identical to withPrivileges but allows you to run an async action.

Implementation

@override
Future<void> withPrivilegesAsync(
  RunPrivilegedAsync action, {
  bool allowUnprivileged = false,
}) async {
  verbose(
    () =>
        'withPrivileges called on UnknownShell. '
        'action called with no privilege changes.',
  );

  restorePrivileges();
  await action();
  releasePrivileges();
}