Giter Club home page Giter Club logo

Comments (7)

gaaclarke avatar gaaclarke commented on June 7, 2024 2

Oh man, well tools like ag will change their output format when they detect they are being piped to another process. git uses the flag --porcelain to indicate output that is verbose and meant to be parsed by another tool.

I think making --verbose imply that is fine and I don't recommend those other approaches.

from flutter.

chinmaygarde avatar chinmaygarde commented on June 7, 2024

Ah, I just filed #147936 which is a duplicate. We need to check that stdout is a terminal type and disable the pretty printing if its not. It is also ok to allow manually disabling pretty printing to terminal types too.

from flutter.

chinmaygarde avatar chinmaygarde commented on June 7, 2024

As an aside, we need to go a bit out our way to fool Xcode since it pretends to be a terminal but can't handle being a terminal quite right. GN does this detection.

from flutter.

chinmaygarde avatar chinmaygarde commented on June 7, 2024

https://api.dart.dev/stable/3.3.4/dart-io/Stdout/hasTerminal.html may be what we need (and the one for stderr).

from flutter.

matanlurey avatar matanlurey commented on June 7, 2024

Update: We do some checks for hasTerminal and supportsAnsiEscapes, but it sounds like those are either insufficient, or give false-positives.

from flutter.

matanlurey avatar matanlurey commented on June 7, 2024

When I do:

flutter % et build -v | grep supportsAnsiEscapes
supportsAnsiEscapes: false | hasTerminal: false

... it appears detection does work, so I'm assuming we're not guarding something we should be.

from flutter.

matanlurey avatar matanlurey commented on June 7, 2024

The fix is as simple as:

diff --git a/tools/engine_tool/lib/src/logger.dart b/tools/engine_tool/lib/src/logger.dart
index 28bd847885..8b4565d94b 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 emit a newline in tests or when not connected to a terminal.
+      _ioSinkWrite(io.stdout, '\n');
       return;
     }

However, it is next to impossible to test because the Logger does a bunch of things with global state.

I'm going to provide a bit more TLC to logger.dart and then land the fix.

from flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.