executeCommand method
Execute a git
CLI command with arguments.
Implementation
Future<ProcessResult> executeCommand({
required List<String> arguments,
bool throwOnExitCodeError = true,
}) async {
const executable = 'git';
logger.trace(
'[GIT] Executing command `$executable ${arguments.join(' ')}` '
'in directory `$workingDirectory`.',
);
final processResult = await Process.run(
executable,
arguments,
workingDirectory: workingDirectory,
);
if (throwOnExitCodeError && processResult.exitCode != 0) {
throw ProcessException(
executable,
arguments,
'Melos: Failed executing a git command: '
'${processResult.stdout} ${processResult.stderr}',
);
}
return processResult;
}