From ced03d7b60748c8f757bba8fb5ff4a8aa1c941fd Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Wed, 8 May 2024 11:12:12 -0700 Subject: [PATCH 1/3] Better support for et when not isTty --- tools/engine_tool/lib/src/logger.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/engine_tool/lib/src/logger.dart b/tools/engine_tool/lib/src/logger.dart index 28bd847885a67..66bfb3c096809 100644 --- a/tools/engine_tool/lib/src/logger.dart +++ b/tools/engine_tool/lib/src/logger.dart @@ -169,6 +169,8 @@ class Logger { /// and emits a carriage return. void clearLine() { if (!io.stdout.hasTerminal || _test) { + // Just write a newline if we're not in a terminal. + _ioSinkWrite(io.stdout, '\n'); return; } _status?.pause(); From ded46e31999d94cb9143887fff0a831282790042 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 9 May 2024 10:24:28 -0700 Subject: [PATCH 2/3] ++ --- tools/engine_tool/lib/src/logger.dart | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/engine_tool/lib/src/logger.dart b/tools/engine_tool/lib/src/logger.dart index 66bfb3c096809..9406e5e46ea97 100644 --- a/tools/engine_tool/lib/src/logger.dart +++ b/tools/engine_tool/lib/src/logger.dart @@ -165,8 +165,16 @@ class Logger { _emitLog(infoLevel, message, indent, newline, fit); } - /// Writes a number of spaces to stdout equal to the width of the terminal - /// and emits a carriage return. + /// Functionally ends and starts a new line. + /// + /// How that is done depends on the terminal capabilities: + /// + /// - If we are not in a terminal, just write a newline. + /// - If we are in a a terminal, any spinners are temporarily paused, the + /// current line is cleared, and spinners are resumed. If ANSI escapes are + /// supported, the cursor is moved to the start of the line and the line is + /// cleared. Otherwise, the line is cleared by writing spaces to the width + /// of the terminal, then moving the cursor back to the start of the line. void clearLine() { if (!io.stdout.hasTerminal || _test) { // Just write a newline if we're not in a terminal. From 11328eaa895278ba431b89c2257d783dc7a162df Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Thu, 9 May 2024 10:24:54 -0700 Subject: [PATCH 3/3] ++ --- tools/engine_tool/lib/src/logger.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/engine_tool/lib/src/logger.dart b/tools/engine_tool/lib/src/logger.dart index 9406e5e46ea97..e77fafc51873c 100644 --- a/tools/engine_tool/lib/src/logger.dart +++ b/tools/engine_tool/lib/src/logger.dart @@ -166,9 +166,9 @@ class Logger { } /// Functionally ends and starts a new line. - /// + /// /// How that is done depends on the terminal capabilities: - /// + /// /// - If we are not in a terminal, just write a newline. /// - If we are in a a terminal, any spinners are temporarily paused, the /// current line is cleared, and spinners are resumed. If ANSI escapes are