Skip to content

Commit f61dfda

Browse files
committed
Limit log line output
1 parent 63314cb commit f61dfda

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pkgs/dart_mcp_server/lib/src/mixins/flutter_launcher.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,13 @@ base mixin FlutterLauncherSupport
176176
// Only output the last 500 lines of logs.
177177
final startPos = math.max(0, logs.length - 500);
178178
final logOutput = logs.sublist(startPos).join('\n');
179+
final truncateMessage = startPos > 0
180+
? '[showing the last 500 lines of a log with '
181+
'${logs.length} lines.]...\n'
182+
: '';
179183
completer.completeError(
180184
'Flutter application exited with code $exitCode before the DTD '
181-
'URI was found, with log output:\n'
182-
'''${startPos > 0 ? '[showing only the last 500 lines of a log with ${logs.length} lines]...' : ''}'''
183-
'$logOutput',
185+
'URI was found, with log output:\n$truncateMessage$logOutput',
184186
);
185187
}
186188
_runningApps.remove(process.pid);

pkgs/dart_mcp_server/test/tools/flutter_launcher_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,9 @@ void main() {
406406
test.expect(result.isError, test.isNot(true));
407407
test.expect(result.structuredContent, {
408408
'logs': [
409+
'[skipping 2 log lines]...',
409410
'[stdout] line 3',
410-
'[stdout] The Dart Tooling Daemon is available at: $dtdUri',
411+
'[stdout] The Dart Tooling Daemon is available at: ws://127.0.0.1:12345/abcdefg=',
411412
],
412413
});
413414
await server.shutdown();

0 commit comments

Comments
 (0)