Print sub process that failed to run in tool (#120999)

This commit is contained in:
Jenn Magder
2023-02-17 14:02:51 -08:00
committed by GitHub
parent f785136852
commit 9fe556705b
2 changed files with 31 additions and 16 deletions

View File

@@ -963,7 +963,8 @@ void main() {
platform: windowsPlatform,
);
const String expectedMessage = 'The flutter tool cannot access the file';
const String expectedMessage = 'Flutter failed to run "foo". The flutter tool cannot access the file or directory.\n'
'Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.';
expect(() async => processManager.start(<String>['foo']),
throwsToolExit(message: expectedMessage));
expect(() async => processManager.run(<String>['foo']),
@@ -1021,7 +1022,8 @@ void main() {
platform: linuxPlatform,
);
const String expectedMessage = 'The flutter tool cannot access the file';
const String expectedMessage = 'Flutter failed to run "foo".\n'
'Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.';
expect(() async => processManager.start(<String>['foo']),
throwsToolExit(message: expectedMessage));
@@ -1085,7 +1087,8 @@ void main() {
platform: macOSPlatform,
);
const String expectedMessage = 'The flutter tool cannot access the file';
const String expectedMessage = 'Flutter failed to run "foo".\n'
'Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.';
expect(() async => processManager.start(<String>['foo']),
throwsToolExit(message: expectedMessage));
@@ -1113,9 +1116,9 @@ void main() {
testWithoutContext('when bad CPU type', () async {
final FakeProcessManager fakeProcessManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(command: <String>['foo'], exception: ProcessException('', <String>[], '', ebadarch)),
const FakeCommand(command: <String>['foo'], exception: ProcessException('', <String>[], '', ebadarch)),
const FakeCommand(command: <String>['foo'], exception: ProcessException('', <String>[], '', ebadarch)),
const FakeCommand(command: <String>['foo', '--bar'], exception: ProcessException('', <String>[], '', ebadarch)),
const FakeCommand(command: <String>['foo', '--bar'], exception: ProcessException('', <String>[], '', ebadarch)),
const FakeCommand(command: <String>['foo', '--bar'], exception: ProcessException('', <String>[], '', ebadarch)),
]);
final ProcessManager processManager = ErrorHandlingProcessManager(
@@ -1123,13 +1126,14 @@ void main() {
platform: macOSPlatform,
);
const String expectedMessage = 'Flutter requires the Rosetta translation environment';
const String expectedMessage = 'Flutter failed to run "foo --bar".\n'
'The binary was built with the incorrect architecture to run on this machine.';
expect(() async => processManager.start(<String>['foo']),
expect(() async => processManager.start(<String>['foo', '--bar']),
throwsToolExit(message: expectedMessage));
expect(() async => processManager.run(<String>['foo']),
expect(() async => processManager.run(<String>['foo', '--bar']),
throwsToolExit(message: expectedMessage));
expect(() => processManager.runSync(<String>['foo']),
expect(() => processManager.runSync(<String>['foo', '--bar']),
throwsToolExit(message: expectedMessage));
});
});