Unverified Commit c4ef0723 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Cocoapods ffi error can be in stdout or stderr (#121470)

Cocoapods ffi error can be in stdout or stderr
parent 2c3fa082
...@@ -361,7 +361,7 @@ class CocoaPods { ...@@ -361,7 +361,7 @@ class CocoaPods {
' pod repo update\n', ' pod repo update\n',
emphasis: true, emphasis: true,
); );
} else if ((stderr.contains('ffi_c.bundle') || stderr.contains('/ffi/')) && } else if ((_isFfiX86Error(stdout) || _isFfiX86Error(stderr)) &&
_operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm64) { _operatingSystemUtils.hostPlatform == HostPlatform.darwin_arm64) {
// https://github.com/flutter/flutter/issues/70796 // https://github.com/flutter/flutter/issues/70796
UsageEvent( UsageEvent(
...@@ -377,6 +377,10 @@ class CocoaPods { ...@@ -377,6 +377,10 @@ class CocoaPods {
} }
} }
bool _isFfiX86Error(String error) {
return error.contains('ffi_c.bundle') || error.contains('/ffi/');
}
void _warnIfPodfileOutOfDate(XcodeBasedProject xcodeProject) { void _warnIfPodfileOutOfDate(XcodeBasedProject xcodeProject) {
final bool isIos = xcodeProject is IosProject; final bool isIos = xcodeProject is IosProject;
if (isIos) { if (isIos) {
......
...@@ -19,6 +19,11 @@ import '../../src/common.dart'; ...@@ -19,6 +19,11 @@ import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/context.dart';
import '../../src/fake_process_manager.dart'; import '../../src/fake_process_manager.dart';
enum _StdioStream {
stdout,
stderr,
}
void main() { void main() {
late FileSystem fileSystem; late FileSystem fileSystem;
late FakeProcessManager fakeProcessManager; late FakeProcessManager fakeProcessManager;
...@@ -492,7 +497,9 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by ...@@ -492,7 +497,9 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
'bus error': '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/library.rb:275: [BUG] Bus Error at 0x000000010072c000', 'bus error': '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/library.rb:275: [BUG] Bus Error at 0x000000010072c000',
}; };
possibleErrors.forEach((String errorName, String cocoaPodsError) { possibleErrors.forEach((String errorName, String cocoaPodsError) {
testUsingContext('ffi $errorName failure on ARM macOS prompts gem install', () async { void testToolExitsWithCocoapodsMessage(_StdioStream outputStream) {
final String streamName = outputStream == _StdioStream.stdout ? 'stdout' : 'stderr';
testUsingContext('ffi $errorName failure to $streamName on ARM macOS prompts gem install', () async {
final FlutterProject projectUnderTest = setupProjectUnderTest(); final FlutterProject projectUnderTest = setupProjectUnderTest();
pretendPodIsInstalled(); pretendPodIsInstalled();
pretendPodVersionIs('100.0.0'); pretendPodVersionIs('100.0.0');
...@@ -509,7 +516,8 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by ...@@ -509,7 +516,8 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
'LANG': 'en_US.UTF-8', 'LANG': 'en_US.UTF-8',
}, },
exitCode: 1, exitCode: 1,
stderr: cocoaPodsError, stdout: outputStream == _StdioStream.stdout ? cocoaPodsError : '',
stderr: outputStream == _StdioStream.stderr ? cocoaPodsError : '',
), ),
const FakeCommand( const FakeCommand(
command: <String>['which', 'sysctl'], command: <String>['which', 'sysctl'],
...@@ -537,6 +545,9 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by ...@@ -537,6 +545,9 @@ Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by
); );
expect(usage.events, contains(const TestUsageEvent('pod-install-failure', 'arm-ffi'))); expect(usage.events, contains(const TestUsageEvent('pod-install-failure', 'arm-ffi')));
}); });
}
testToolExitsWithCocoapodsMessage(_StdioStream.stdout);
testToolExitsWithCocoapodsMessage(_StdioStream.stderr);
}); });
testUsingContext('ffi failure on x86 macOS does not prompt gem install', () async { testUsingContext('ffi failure on x86 macOS does not prompt gem install', () async {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment