From 4d5ef253789f47353ee8f4ea972583b522c93863 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Thu, 26 May 2022 20:12:42 +0800 Subject: [PATCH] set exitcode to zero if have fixed --- lib/src/dependency_validator.dart | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/src/dependency_validator.dart b/lib/src/dependency_validator.dart index 6129c54..1721090 100644 --- a/lib/src/dependency_validator.dart +++ b/lib/src/dependency_validator.dart @@ -357,16 +357,18 @@ Future 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) {