diff --git a/packages/flutter_tools/lib/src/macos/xcode.dart b/packages/flutter_tools/lib/src/macos/xcode.dart index 3eb485e3039..7b3b915a571 100644 --- a/packages/flutter_tools/lib/src/macos/xcode.dart +++ b/packages/flutter_tools/lib/src/macos/xcode.dart @@ -26,6 +26,8 @@ class Xcode { _xcodeSelectPath = processManager.runSync(['/usr/bin/xcode-select', '--print-path']).stdout.trim(); } on ProcessException { // Ignored, return null below. + } on ArgumentError { + // Ignored, return null below. } } return _xcodeSelectPath; diff --git a/packages/flutter_tools/test/general.shard/macos/xcode_test.dart b/packages/flutter_tools/test/general.shard/macos/xcode_test.dart index ece4fd786ae..99b96bbff55 100644 --- a/packages/flutter_tools/test/general.shard/macos/xcode_test.dart +++ b/packages/flutter_tools/test/general.shard/macos/xcode_test.dart @@ -30,6 +30,9 @@ void main() { when(mockProcessManager.runSync(['/usr/bin/xcode-select', '--print-path'])) .thenThrow(const ProcessException('/usr/bin/xcode-select', ['--print-path'])); expect(xcode.xcodeSelectPath, isNull); + when(mockProcessManager.runSync(['/usr/bin/xcode-select', '--print-path'])) + .thenThrow(ArgumentError('Invalid argument(s): Cannot find executable for /usr/bin/xcode-select')); + expect(xcode.xcodeSelectPath, isNull); }, overrides: { ProcessManager: () => mockProcessManager, });