Skip to content

Restore ANSI colors from iOS simulator logs#186605

Open
mvincentong wants to merge 1 commit into
flutter:mainfrom
mvincentong:fix-ios-simulator-ansi-log-colors
Open

Restore ANSI colors from iOS simulator logs#186605
mvincentong wants to merge 1 commit into
flutter:mainfrom
mvincentong:fix-ios-simulator-ansi-log-colors

Conversation

@mvincentong
Copy link
Copy Markdown

@mvincentong mvincentong commented May 16, 2026

Issue

Fixes #20663.

Fix

Normalize the ANSI escape placeholders emitted by Apple unified logging before iOS Simulator log lines are forwarded to Flutter tooling output. The change restores CSI sequences such as color starts and resets after the eventMessage JSON string has been decoded.

Tests

  • ../../bin/dart test test/general.shard/ios/simulators_test.dart
  • ../../bin/dart analyze lib/src/ios/simulators.dart test/general.shard/ios/simulators_test.dart
  • ./bin/dart format --output=none --set-exit-if-changed packages/flutter_tools/lib/src/ios/simulators.dart packages/flutter_tools/test/general.shard/ios/simulators_test.dart
  • git diff --check

Risk

Low. The normalization is limited to the iOS Simulator unified-log reader and only runs when the decoded message contains an Apple escaped ANSI CSI pattern or the later ESC placeholder reported in the issue.

@mvincentong mvincentong requested a review from a team as a code owner May 16, 2026 04:31
@github-actions github-actions Bot added platform-ios iOS applications specifically tool Affects the "flutter" command-line tool. See also t: labels. team-ios Owned by iOS platform team labels May 16, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces logic to restore ANSI escape sequences in iOS simulator logs that are escaped by Apple's unified logging system. It adds a regex and a helper method to convert these escaped patterns back to standard ANSI codes, along with a unit test to verify the behavior. Review feedback identifies a style guide violation regarding the use of triple-slash documentation for private members and points out a logic issue where the early return check in the restoration method could skip messages containing only certain escaped characters.

Comment thread packages/flutter_tools/lib/src/ios/simulators.dart Outdated
Comment thread packages/flutter_tools/lib/src/ios/simulators.dart Outdated
@mvincentong mvincentong force-pushed the fix-ios-simulator-ansi-log-colors branch from 2178c00 to 8b975b8 Compare May 16, 2026 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform-ios iOS applications specifically team-ios Owned by iOS platform team tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant