have xcodeSelectPath also catch ArgumentError (#37521)

This commit is contained in:
Christopher Fujino 2019-08-02 16:08:49 -07:00 committed by GitHub
parent 40c5cc9708
commit 5fb2d2aeea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -26,6 +26,8 @@ class Xcode {
_xcodeSelectPath = processManager.runSync(<String>['/usr/bin/xcode-select', '--print-path']).stdout.trim();
} on ProcessException {
// Ignored, return null below.
} on ArgumentError {
// Ignored, return null below.
}
}
return _xcodeSelectPath;

View File

@ -30,6 +30,9 @@ void main() {
when(mockProcessManager.runSync(<String>['/usr/bin/xcode-select', '--print-path']))
.thenThrow(const ProcessException('/usr/bin/xcode-select', <String>['--print-path']));
expect(xcode.xcodeSelectPath, isNull);
when(mockProcessManager.runSync(<String>['/usr/bin/xcode-select', '--print-path']))
.thenThrow(ArgumentError('Invalid argument(s): Cannot find executable for /usr/bin/xcode-select'));
expect(xcode.xcodeSelectPath, isNull);
}, overrides: <Type, Generator>{
ProcessManager: () => mockProcessManager,
});