Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1510)

Unified Diff: sdk/lib/_internal/pub/lib/src/utils.dart

Issue 66303006: Pub shouldn't emit colored log output unless it's to a terminal. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/utils.dart
diff --git a/sdk/lib/_internal/pub/lib/src/utils.dart b/sdk/lib/_internal/pub/lib/src/utils.dart
index 931b1770e67280bfe81f3fb11e55df0909f2256a..dcbd520d2d2e3f09a7abe6d079d381ccfd7175bc 100644
--- a/sdk/lib/_internal/pub/lib/src/utils.dart
+++ b/sdk/lib/_internal/pub/lib/src/utils.dart
@@ -590,12 +590,18 @@ String libraryPath(String libraryName) {
return path.fromUri(lib.uri);
}
-/// Gets a "special" string (ANSI escape or Unicode). On Windows, returns
-/// something else since those aren't supported.
+/// Gets a "special" string (ANSI escape or Unicode).
+///
+/// On Windows or when not printing to a terminal, returns something else since
+/// those aren't supported.
String getSpecial(String color, [String onWindows = '']) {
// No ANSI escapes on windows or when running tests.
- if (runningAsTest || Platform.operatingSystem == 'windows') return onWindows;
- return color;
+ if (runningAsTest || Platform.operatingSystem == 'windows' ||
+ stdioType(stdout) != StdioType.TERMINAL) {
+ return onWindows;
+ } else {
+ return color;
+ }
}
/// Prepends each line in [text] with [prefix]. If [firstPrefix] is passed, the
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698