| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 final String message; | 209 final String message; |
| 210 final OSError osError; | 210 final OSError osError; |
| 211 | 211 |
| 212 const StdoutException(this.message, [this.osError]); | 212 const StdoutException(this.message, [this.osError]); |
| 213 | 213 |
| 214 String toString() { | 214 String toString() { |
| 215 return "StdoutException: $message${osError == null ? "" : ", $osError"}"; | 215 return "StdoutException: $message${osError == null ? "" : ", $osError"}"; |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 |
| 220 class StdinException implements IOException { |
| 221 final String message; |
| 222 final OSError osError; |
| 223 |
| 224 const StdinException(this.message, [this.osError]); |
| 225 |
| 226 String toString() { |
| 227 return "StdinException: $message${osError == null ? "" : ", $osError"}"; |
| 228 } |
| 229 } |
| 230 |
| 231 |
| 219 class _StdConsumer implements StreamConsumer<List<int>> { | 232 class _StdConsumer implements StreamConsumer<List<int>> { |
| 220 final _file; | 233 final _file; |
| 221 | 234 |
| 222 _StdConsumer(int fd) : _file = _File._openStdioSync(fd); | 235 _StdConsumer(int fd) : _file = _File._openStdioSync(fd); |
| 223 | 236 |
| 224 Future addStream(Stream<List<int>> stream) { | 237 Future addStream(Stream<List<int>> stream) { |
| 225 var completer = new Completer(); | 238 var completer = new Completer(); |
| 226 var sub; | 239 var sub; |
| 227 sub = stream.listen( | 240 sub = stream.listen( |
| 228 (data) { | 241 (data) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 } | 365 } |
| 353 | 366 |
| 354 | 367 |
| 355 class _StdIOUtils { | 368 class _StdIOUtils { |
| 356 external static _getStdioOutputStream(int fd); | 369 external static _getStdioOutputStream(int fd); |
| 357 external static Stdin _getStdioInputStream(); | 370 external static Stdin _getStdioInputStream(); |
| 358 /// Returns the socket type or `null` if [socket] is not a builtin socket. | 371 /// Returns the socket type or `null` if [socket] is not a builtin socket. |
| 359 external static int _socketType(Socket socket); | 372 external static int _socketType(Socket socket); |
| 360 external static _getStdioHandleType(int fd); | 373 external static _getStdioHandleType(int fd); |
| 361 } | 374 } |
| OLD | NEW |