From 5fb2d2aeea493fc1545ce1bc337fe65ebf520a65 Mon Sep 17 00:00:00 2001 From: Christopher Fujino Date: Fri, 2 Aug 2019 16:08:49 -0700 Subject: [PATCH] have xcodeSelectPath also catch ArgumentError (#37521) --- packages/flutter_tools/lib/src/macos/xcode.dart | 2 ++ .../flutter_tools/test/general.shard/macos/xcode_test.dart | 3 +++ 2 files changed, 5 insertions(+) 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, });