run method

Future<ProcessResult> run(
  1. String executable,
  2. List<String> arguments, {
  3. String? workingDirectory,
})

Runs an executable with the given executable name and arguments.

Optionally sets the workingDirectory. Returns the standard output of the process if successful. Throws an exception if the process fails.

Implementation

Future<ProcessResult> run(
  String executable,
  List<String> arguments, {
  String? workingDirectory,
}) async {
  _logger.detail('Running: $executable ${arguments.join(' ')}');

  try {
    final result = await _runProcess(
      executable,
      arguments,
      workingDirectory: workingDirectory,
      runInShell: true,
    );

    return result;
  } on ProcessException catch (e) {
    throw ReleaseManagerException(
      'Process failed to start: $executable',
      details: e.message,
    );
  }
}