[tool] combine run and runAndExitOnError (#3827)

This commit is contained in:
Chris Yang
2021-04-27 09:35:05 -07:00
committed by GitHub
parent 3c57df37c0
commit 189845bb8a
7 changed files with 87 additions and 75 deletions

View File

@ -56,9 +56,13 @@ class FormatCommand extends PluginCommand {
}
Future<bool> _didModifyAnything() async {
final io.ProcessResult modifiedFiles = await processRunner
.runAndExitOnError('git', <String>['ls-files', '--modified'],
workingDir: packagesDir);
final io.ProcessResult modifiedFiles = await processRunner.run(
'git',
<String>['ls-files', '--modified'],
workingDir: packagesDir,
exitOnError: true,
logOnError: true,
);
print('\n\n');
@ -76,8 +80,13 @@ class FormatCommand extends PluginCommand {
'this command into your terminal:');
print('patch -p1 <<DONE');
final io.ProcessResult diff = await processRunner
.runAndExitOnError('git', <String>['diff'], workingDir: packagesDir);
final io.ProcessResult diff = await processRunner.run(
'git',
<String>['diff'],
workingDir: packagesDir,
exitOnError: true,
logOnError: true,
);
print(diff.stdout);
print('DONE');
return true;