execute method

  1. @mustCallSuper
Future execute([
  1. List<String> args = const []
])

Starts the DarwinSystem with the current configuration and statically links DarwinSystem.internalInstance as well as system.

Implementation

@mustCallSuper
Future execute([List<String> args = const []]) async {
  var currentSystem = _system;
  currentSystem ??= DarwinSystem.internalInstance;
  /// Infer current execution profile
  currentSystem.configurationSourceList = configurationSources;
  if (currentSystem.profile == null) {
    currentSystem.profile = DefaultProfiles.release;
    assert((){
      currentSystem!.profile = DefaultProfiles.debug;
      return true;
    }());
  }
  currentSystem.applicationArgs = args;
  _system = currentSystem;
  DarwinSystem.internalInstance = currentSystem;
  plugins.sort((a, b) =>
      a.loadOrder.compareTo(b.loadOrder)); // Sort plugins by priority
  var userArgs = DarwinSystemUserArgs(appModule: module, plugins: plugins);
  await currentSystem.prepare(_generatedArgs!, userArgs);
  if (exitProcessOnStop) {
    currentSystem.eventbus
        .getAsyncLine<KillEvent>()
        .subscribeNext(priority: EventPriority.highest)
        .then((value) => exit(0));
  }
  await currentSystem.start(_generatedArgs!, userArgs);
  _hookDaemons();
  if (watchProcessSignals) _watchSignals();
}