diff --git a/packages/flutter_tools/lib/src/base/process.dart b/packages/flutter_tools/lib/src/base/process.dart index 108bce6a74..d1372093bd 100644 --- a/packages/flutter_tools/lib/src/base/process.dart +++ b/packages/flutter_tools/lib/src/base/process.dart @@ -277,7 +277,7 @@ class _DefaultProcessUtils implements ProcessUtils { _logger.printTrace(runResult.toString()); if (throwOnError && runResult.exitCode != 0 && (allowedFailures == null || !allowedFailures(runResult.exitCode))) { - runResult.throwException('Process exited abnormally:\n$runResult'); + runResult.throwException('Process exited abnormally with exit code ${runResult.exitCode}:\n$runResult'); } return runResult; } @@ -341,7 +341,7 @@ class _DefaultProcessUtils implements ProcessUtils { _logger.printTrace(runResult.toString()); if (throwOnError && runResult.exitCode != 0 && (allowedFailures == null || !allowedFailures(exitCode))) { - runResult.throwException('Process exited abnormally:\n$runResult'); + runResult.throwException('Process exited abnormally with exit code $exitCode:\n$runResult'); } return runResult; } @@ -407,7 +407,7 @@ class _DefaultProcessUtils implements ProcessUtils { } if (failedExitCode && throwOnError) { - String message = 'The command failed'; + String message = 'The command failed with exit code ${runResult.exitCode}'; if (verboseExceptions) { message = 'The command failed\nStdout:\n${runResult.stdout}\n' 'Stderr:\n${runResult.stderr}'; diff --git a/packages/flutter_tools/test/general.shard/base/process_test.dart b/packages/flutter_tools/test/general.shard/base/process_test.dart index 51e6c2d102..aa13e307c1 100644 --- a/packages/flutter_tools/test/general.shard/base/process_test.dart +++ b/packages/flutter_tools/test/general.shard/base/process_test.dart @@ -33,7 +33,10 @@ void main() { exitCode: 1, )); - expect(() async => processUtils.run(['false'], throwOnError: true), throwsProcessException()); + expect( + () async => processUtils.run(['false'], throwOnError: true), + throwsProcessException(message: 'Process exited abnormally with exit code 1'), + ); }); }); diff --git a/packages/flutter_tools/test/integration.shard/plist_parser_test.dart b/packages/flutter_tools/test/integration.shard/plist_parser_test.dart index 2aa2089a3b..da1dd99108 100644 --- a/packages/flutter_tools/test/integration.shard/plist_parser_test.dart +++ b/packages/flutter_tools/test/integration.shard/plist_parser_test.dart @@ -123,7 +123,7 @@ void main() { expect(logger.statusText, contains('Property List error: Unexpected character \x01 at line 1 / ' 'JSON error: JSON text did not start with array or object and option to allow fragments not ' 'set. around line 1, column 0.\n')); - expect(logger.errorText, 'ProcessException: The command failed\n' + expect(logger.errorText, 'ProcessException: The command failed with exit code 1\n' ' Command: /usr/bin/plutil -convert xml1 -o - ${file.absolute.path}\n'); }, skip: !platform.isMacOS); // [intended] requires macos tool chain. @@ -185,7 +185,7 @@ void main() { expect(logger.statusText, contains('foo.plist: Property List error: Unexpected character \x01 ' 'at line 1 / JSON error: JSON text did not start with array or object and option to allow ' 'fragments not set. around line 1, column 0.\n')); - expect(logger.errorText, equals('ProcessException: The command failed\n' + expect(logger.errorText, equals('ProcessException: The command failed with exit code 1\n' ' Command: /usr/bin/plutil -replace CFBundleIdentifier -string dev.flutter.fake foo.plist\n')); }, skip: !platform.isMacOS); // [intended] requires macos tool chain.