runProjectCommand method

Future<ProcessResult> runProjectCommand(
  1. String command, {
  2. String? workDir,
})

Runs a shell command in the project directory.

Implementation

Future<ProcessResult> runProjectCommand(
  String command, {
  String? workDir,
}) async {
  final parts = command.split(RegExp(r'\s+'));
  if (parts.isEmpty) {
    throw ArgumentError('Empty command');
  }

  return Process.run(
    parts.first,
    parts.sublist(1),
    workingDirectory: workDir,
    stdoutEncoding: utf8,
    stderrEncoding: utf8,
  );
}