run property

Future<int> get run

Implementation

Future<int> get run async {
  final commandCli = CommandlineConverter().convert(this);

  final executable = commandCli.first;
  final arguments = commandCli.sublist(1);

  final process = await Process.start(
    executable,
    arguments,
    runInShell: true,
    environment: Platform.environment,
  );
  process.stdout.transform(utf8.decoder).listen(stdout.write);
  process.stderr.transform(utf8.decoder).listen(stderr.write);

  final exitCode = await process.exitCode;

  if (exitCode > 0) {
    StatusHelper.failed('$this has exit with code $exitCode',
        statusExit: exitCode);
  }

  return exitCode;
}