| 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 patch class _StdIOUtils { | 5 patch class _StdIOUtils { |
| 6 static Stdin _getStdioInputStream() { | 6 static Stdin _getStdioInputStream() { |
| 7 switch (_getStdioHandleType(0)) { | 7 switch (_getStdioHandleType(0)) { |
| 8 case _STDIO_HANDLE_TYPE_TERMINAL: | 8 case _STDIO_HANDLE_TYPE_TERMINAL: |
| 9 case _STDIO_HANDLE_TYPE_PIPE: | 9 case _STDIO_HANDLE_TYPE_PIPE: |
| 10 case _STDIO_HANDLE_TYPE_SOCKET: | 10 case _STDIO_HANDLE_TYPE_SOCKET: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 case _STDIO_HANDLE_TYPE_FILE: | 25 case _STDIO_HANDLE_TYPE_FILE: |
| 26 return new Stdout._(new IOSink(new _StdConsumer(fd)), fd); | 26 return new Stdout._(new IOSink(new _StdConsumer(fd)), fd); |
| 27 default: | 27 default: |
| 28 throw new FileSystemException("Unsupported stdin type"); | 28 throw new FileSystemException("Unsupported stdin type"); |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 | 31 |
| 32 static int _socketType(nativeSocket) { | 32 static int _socketType(nativeSocket) { |
| 33 var result = _getSocketType(nativeSocket); | 33 var result = _getSocketType(nativeSocket); |
| 34 if (result is OSError) { | 34 if (result is OSError) { |
| 35 throw new FileSystemException("Error retreiving socket type", "", result); | 35 throw new FileSystemException("Error retrieving socket type", "", result); |
| 36 } | 36 } |
| 37 return result; | 37 return result; |
| 38 } | 38 } |
| 39 | 39 |
| 40 static _getStdioHandleType(int fd) native "File_GetStdioHandleType"; | 40 static _getStdioHandleType(int fd) native "File_GetStdioHandleType"; |
| 41 } | 41 } |
| 42 | 42 |
| 43 patch class Stdin { | 43 patch class Stdin { |
| 44 /* patch */ int readByteSync() native "Stdin_ReadByte"; | 44 /* patch */ int readByteSync() native "Stdin_ReadByte"; |
| 45 | 45 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 75 } | 75 } |
| 76 return size; | 76 return size; |
| 77 } | 77 } |
| 78 | 78 |
| 79 static _getTerminalSize(int fd) native "Stdout_GetTerminalSize"; | 79 static _getTerminalSize(int fd) native "Stdout_GetTerminalSize"; |
| 80 } | 80 } |
| 81 | 81 |
| 82 | 82 |
| 83 _getStdioHandle(_NativeSocket socket, int num) native "Socket_GetStdioHandle"; | 83 _getStdioHandle(_NativeSocket socket, int num) native "Socket_GetStdioHandle"; |
| 84 _getSocketType(_NativeSocket nativeSocket) native "Socket_GetType"; | 84 _getSocketType(_NativeSocket nativeSocket) native "Socket_GetType"; |
| OLD | NEW |