Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 const int _STDIO_HANDLE_TYPE_TERMINAL = 0; | 7 const int _STDIO_HANDLE_TYPE_TERMINAL = 0; |
| 8 const int _STDIO_HANDLE_TYPE_PIPE = 1; | 8 const int _STDIO_HANDLE_TYPE_PIPE = 1; |
| 9 const int _STDIO_HANDLE_TYPE_FILE = 2; | 9 const int _STDIO_HANDLE_TYPE_FILE = 2; |
| 10 const int _STDIO_HANDLE_TYPE_SOCKET = 3; | 10 const int _STDIO_HANDLE_TYPE_SOCKET = 3; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 * If enabled, characters are delayed until a new-line character is entered. | 130 * If enabled, characters are delayed until a new-line character is entered. |
| 131 * If disabled, characters will be available as typed. | 131 * If disabled, characters will be available as typed. |
| 132 * | 132 * |
| 133 * Default depends on the parent process, but usually enabled. | 133 * Default depends on the parent process, but usually enabled. |
| 134 * | 134 * |
| 135 * On Windows this mode can only be disabled if [echoMode] is disabled as well . | 135 * On Windows this mode can only be disabled if [echoMode] is disabled as well . |
| 136 */ | 136 */ |
| 137 external void set lineMode(bool enabled); | 137 external void set lineMode(bool enabled); |
| 138 | 138 |
| 139 /** | 139 /** |
| 140 * When connected to a terminal, whether ANSI codes are supported. | |
|
Lasse Reichstein Nielsen
2017/03/17 08:55:29
This is very vague.
"ANSI codes" should probably
Lasse Reichstein Nielsen
2017/03/17 08:55:29
It doesn't say what happens when it's not connecte
zra
2017/03/17 15:38:51
Done.
zra
2017/03/17 15:38:51
Done.
| |
| 141 * | |
| 142 * This is `true` if the TERM environment variable contains the string | |
| 143 * 'xterm', except on Windows where support is detected only in recent | |
| 144 * versions of Windows 10. | |
|
Lasse Reichstein Nielsen
2017/03/17 08:55:28
This is very specific. Consider just saying:
Not
zra
2017/03/17 15:38:51
Done.
Flutter is recommending PowerShell on Windo
Lasse Reichstein Nielsen
2017/03/17 16:02:49
This is not Flutter specific, the comment applies
zra
2017/03/17 17:45:35
I'm afraid I don't follow you. You asked whether v
| |
| 145 */ | |
| 146 external bool get ansiSupported; | |
|
Lasse Reichstein Nielsen
2017/03/17 08:55:29
I'd prefer a name like `supportsAnsiEscapes` (or *
zra
2017/03/17 15:38:51
Done.
| |
| 147 | |
| 148 /** | |
| 140 * Synchronously read a byte from stdin. This call will block until a byte is | 149 * Synchronously read a byte from stdin. This call will block until a byte is |
| 141 * available. | 150 * available. |
| 142 * | 151 * |
| 143 * If at end of file, -1 is returned. | 152 * If at end of file, -1 is returned. |
| 144 */ | 153 */ |
| 145 external int readByteSync(); | 154 external int readByteSync(); |
| 146 } | 155 } |
| 147 | 156 |
| 148 /** | 157 /** |
| 149 * [Stdout] represents the [IOSink] for either `stdout` or `stderr`. | 158 * [Stdout] represents the [IOSink] for either `stdout` or `stderr`. |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 179 int get terminalColumns => _terminalColumns(_fd); | 188 int get terminalColumns => _terminalColumns(_fd); |
| 180 | 189 |
| 181 /** | 190 /** |
| 182 * Get the number of lines of the terminal. | 191 * Get the number of lines of the terminal. |
| 183 * | 192 * |
| 184 * If no terminal is attached to stdout, a [StdoutException] is thrown. See | 193 * If no terminal is attached to stdout, a [StdoutException] is thrown. See |
| 185 * [hasTerminal] for more info. | 194 * [hasTerminal] for more info. |
| 186 */ | 195 */ |
| 187 int get terminalLines => _terminalLines(_fd); | 196 int get terminalLines => _terminalLines(_fd); |
| 188 | 197 |
| 198 /** | |
| 199 * When connected to a terminal, whether ANSI codes are supported. | |
| 200 * | |
| 201 * This is `true` if the TERM environment variable contains the string | |
| 202 * 'xterm', except on Windows where support is detected only in recent | |
| 203 * versions of Windows 10. | |
| 204 */ | |
| 205 bool get ansiSupported => _ansiSupported(_fd); | |
| 206 | |
| 189 external bool _hasTerminal(int fd); | 207 external bool _hasTerminal(int fd); |
| 190 external int _terminalColumns(int fd); | 208 external int _terminalColumns(int fd); |
| 191 external int _terminalLines(int fd); | 209 external int _terminalLines(int fd); |
| 210 external static bool _ansiSupported(int fd); | |
| 192 | 211 |
| 193 /** | 212 /** |
| 194 * Get a non-blocking `IOSink`. | 213 * Get a non-blocking `IOSink`. |
| 195 */ | 214 */ |
| 196 IOSink get nonBlocking { | 215 IOSink get nonBlocking { |
| 197 if (_nonBlocking == null) { | 216 if (_nonBlocking == null) { |
| 198 _nonBlocking = new IOSink(new _FileStreamConsumer.fromStdio(_fd)); | 217 _nonBlocking = new IOSink(new _FileStreamConsumer.fromStdio(_fd)); |
| 199 } | 218 } |
| 200 return _nonBlocking; | 219 return _nonBlocking; |
| 201 } | 220 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 } | 419 } |
| 401 | 420 |
| 402 class _StdIOUtils { | 421 class _StdIOUtils { |
| 403 external static _getStdioOutputStream(int fd); | 422 external static _getStdioOutputStream(int fd); |
| 404 external static Stdin _getStdioInputStream(); | 423 external static Stdin _getStdioInputStream(); |
| 405 | 424 |
| 406 /// Returns the socket type or `null` if [socket] is not a builtin socket. | 425 /// Returns the socket type or `null` if [socket] is not a builtin socket. |
| 407 external static int _socketType(Socket socket); | 426 external static int _socketType(Socket socket); |
| 408 external static _getStdioHandleType(int fd); | 427 external static _getStdioHandleType(int fd); |
| 409 } | 428 } |
| OLD | NEW |