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

Unified Diff: runtime/bin/stdio_patch.dart

Issue 2753233002: [dart:io] Move Platform.ansiSupported to {Stdin,Stdout}.supportsAnsiEscapes (Closed)
Patch Set: Fix typo Created 3 years, 9 months 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
Index: runtime/bin/stdio_patch.dart
diff --git a/runtime/bin/stdio_patch.dart b/runtime/bin/stdio_patch.dart
index e537dc87212029c4cb756032c4949d545cdb1897..d33fbc2123d23a8d5cde76abe967abc5423af367 100644
--- a/runtime/bin/stdio_patch.dart
+++ b/runtime/bin/stdio_patch.dart
@@ -83,11 +83,20 @@
}
}
+ @patch bool get supportsAnsiEscapes {
+ var result = _supportsAnsiEscapes();
+ if (result is OSError) {
+ throw new StdinException("Error determining ANSI support", result);
+ }
+ return result;
+ }
+
static _echoMode() native "Stdin_GetEchoMode";
static _setEchoMode(bool enabled) native "Stdin_SetEchoMode";
static _lineMode() native "Stdin_GetLineMode";
static _setLineMode(bool enabled) native "Stdin_SetLineMode";
static _readByte() native "Stdin_ReadByte";
+ static _supportsAnsiEscapes() native "Stdin_AnsiSupported";
}
@patch class Stdout {
@@ -112,6 +121,16 @@
}
static _getTerminalSize(int fd) native "Stdout_GetTerminalSize";
+
+ @patch static bool _supportsAnsiEscapes(int fd) {
+ var result = _getAnsiSupported(fd);
+ if (result is! bool) {
+ throw new StdoutException("Error determining ANSI support", result);
siva 2017/03/17 23:54:24 Would it make sense to include the 'fd' in the exc
+ }
+ return result;
+ }
+
+ static _getAnsiSupported(int fd) native "Stdout_AnsiSupported";
}

Powered by Google App Engine
This is Rietveld 408576698