Move spinner `_defaultSlowWarning` message to a new line (#30071)
* write newline before adding slow restart message to spinner
* update existing test
diff --git a/packages/flutter_tools/lib/src/base/logger.dart b/packages/flutter_tools/lib/src/base/logger.dart
index 14c17f8..b1402d2 100644
--- a/packages/flutter_tools/lib/src/base/logger.dart
+++ b/packages/flutter_tools/lib/src/base/logger.dart
@@ -620,6 +620,8 @@
final String _backspaceChar = '\b';
final String _clearChar = ' ';
+ bool timedOut = false;
+
int ticks = 0;
Timer timer;
@@ -660,15 +662,19 @@
assert(timer.isActive);
stdout.write(_backspace);
ticks += 1;
- stdout.write('${_clearChar * spinnerIndent}$_currentAnimationFrame');
if (seemsSlow) {
+ if (!timedOut) {
+ timedOut = true;
+ stdout.write('$_clear\n');
+ }
if (slowWarningCallback != null) {
- _slowWarning = ' ' + slowWarningCallback();
+ _slowWarning = slowWarningCallback();
} else {
- _slowWarning = ' ' + _defaultSlowWarning;
+ _slowWarning = _defaultSlowWarning;
}
stdout.write(_slowWarning);
}
+ stdout.write('${_clearChar * spinnerIndent}$_currentAnimationFrame');
}
@override
diff --git a/packages/flutter_tools/test/base/logger_test.dart b/packages/flutter_tools/test/base/logger_test.dart
index d658955..e650ce5 100644
--- a/packages/flutter_tools/test/base/logger_test.dart
+++ b/packages/flutter_tools/test/base/logger_test.dart
@@ -148,7 +148,8 @@
await tenMillisecondsLater;
doWhileAsync(time, () => ansiSpinner.ticks < 30); // three seconds
expect(ansiSpinner.seemsSlow, isTrue);
- expect(outputStdout().join('\n'), contains('This is taking an unexpectedly long time.'));
+ // Check the 2nd line to verify there's a newline before the warning
+ expect(outputStdout()[1], contains('This is taking an unexpectedly long time.'));
ansiSpinner.stop();
expect(outputStdout().join('\n'), isNot(contains('(!)')));
done = true;