| 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 Stdio _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: |
| 11 return new Stdin._(new _Socket._readPipe(0)); | 11 return new Stdin._(new _Socket._readPipe(0)); |
| 12 case _STDIO_HANDLE_TYPE_FILE: | 12 case _STDIO_HANDLE_TYPE_FILE: |
| 13 return new Stdin._(new _FileStream.forStdin()); | 13 return new Stdin._(new _FileStream.forStdin()); |
| 14 default: | 14 default: |
| 15 throw new FileException("Unsupported stdin type"); | 15 throw new FileException("Unsupported stdin type"); |
| 16 } | 16 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 patch class Stdin { | 42 patch class Stdin { |
| 43 /* patch */ int readByteSync() native "Stdin_ReadByte"; | 43 /* patch */ int readByteSync() native "Stdin_ReadByte"; |
| 44 } | 44 } |
| 45 | 45 |
| 46 | 46 |
| 47 _getStdioHandle(_NativeSocket socket, int num) native "Socket_GetStdioHandle"; | 47 _getStdioHandle(_NativeSocket socket, int num) native "Socket_GetStdioHandle"; |
| 48 _getStdioHandleType(int num) native "File_GetStdioHandleType"; | 48 _getStdioHandleType(int num) native "File_GetStdioHandleType"; |
| 49 _getSocketType(_NativeSocket nativeSocket) native "Socket_GetType"; | 49 _getSocketType(_NativeSocket nativeSocket) native "Socket_GetType"; |
| OLD | NEW |