Unverified Commit be3a4b37 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] don't trim log messages from the web (#53379)

parent 2717eb64
......@@ -672,7 +672,7 @@ class _ResidentWebRunner extends ResidentWebRunner {
// thrown if we're not already subscribed.
}
_stdOutSub = _vmService.onStdoutEvent.listen((vmservice.Event log) {
final String message = utf8.decode(base64.decode(log.bytes)).trim();
final String message = utf8.decode(base64.decode(log.bytes));
globals.printStatus(message);
});
unawaited(_vmService.registerService('reloadSources', 'FlutterTools'));
......
......@@ -480,6 +480,30 @@ void main() {
Usage: () => MockFlutterUsage(),
}));
test('Faithfully displays stdout messages with leading/trailing spaces', () => testbed.run(() async {
_setupMocks();
final StreamController<Event> stdoutController = StreamController<Event>();
when(mockVmService.onStdoutEvent).thenAnswer((Invocation invocation) {
return stdoutController.stream;
});
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
unawaited(residentWebRunner.run(
connectionInfoCompleter: connectionInfoCompleter,
));
await connectionInfoCompleter.future;
stdoutController.add(Event(
timestamp: 0,
kind: 'Stdout',
bytes: base64.encode(utf8.encode(' This is a message with 4 leading and trailing spaces '))),
);
// Wait one event loop for the stream listener to fire.
await null;
expect(testLogger.statusText,
contains(' This is a message with 4 leading and trailing spaces '));
}));
test('Fails on compilation errors in hot restart', () => testbed.run(() async {
_setupMocks();
final Completer<DebugConnectionInfo> connectionInfoCompleter = Completer<DebugConnectionInfo>();
......
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