runDartExe function

Future<Process> runDartExe(
  1. File dartExec, {
  2. List<String> args = const [],
  3. String? workingDirectory,
  4. Map<String, String>? environment,
})

Run a Dart binary created via the createDartExe method.

Implementation

Future<Process> runDartExe(File dartExec,
    {List<String> args = const [],
    String? workingDirectory,
    Map<String, String>? environment}) async {
  if (!await dartExec.exists()) {
    throw DartleException(
        message: 'Cannot run Dart executable as it does '
            'not exist: ${dartExec.path}');
  }
  final proc = Process.start(dartExec.absolute.path, args,
      workingDirectory: workingDirectory, environment: environment);

  logger.fine('Running compiled Dartle build: ${dartExec.path}');

  return proc;
}