Skip to content

Commit

Permalink
set exitcode to zero if have fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
fzyzcjy committed May 26, 2022
1 parent c0afd1f commit 4d5ef25
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/src/dependency_validator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -357,16 +357,18 @@ Future<void> run({required bool shouldAutoFix}) async {
final autoFixCommand = autoFix.compile();
if (autoFixCommand.isNotEmpty) {
logger.info('Suggestion for auto fix: ${autoFixCommand}');
}

if (shouldAutoFix) {
logger.info('Start autofix...');
final process = await Process.start('/bin/sh', ['-euxc', autoFixCommand]);
process.stdout.pipe(stdout);
process.stderr.pipe(stderr);
final exitCode = await process.exitCode;
if (exitCode != 0) throw Exception('process exit with exitCode=$exitCode');
logger.info('End autofix.');
}
if (shouldAutoFix && autoFixCommand.isNotEmpty) {
logger.info('Start autofix...');
final process = await Process.start('/bin/sh', ['-euxc', autoFixCommand]);
process.stdout.pipe(stdout);
process.stderr.pipe(stderr);
final exitCode = await process.exitCode;
if (exitCode != 0) throw Exception('process exit with exitCode=$exitCode');
logger.info('End autofix.');

exitCode = 0;
}

if (exitCode == 0) {
Expand Down

0 comments on commit 4d5ef25

Please sign in to comment.