Chromium Code Reviews| Index: sdk/lib/io/stdio.dart |
| diff --git a/sdk/lib/io/stdio.dart b/sdk/lib/io/stdio.dart |
| index feea4fffc08249eb5d100e1b81c210fec024f138..8fb196dbaae0e55c63dd85117146077cb63c90dd 100644 |
| --- a/sdk/lib/io/stdio.dart |
| +++ b/sdk/lib/io/stdio.dart |
| @@ -328,13 +328,19 @@ StdioType stdioType(object) { |
| return StdioType.FILE; |
| } |
| if (object is Socket) { |
| - switch (_StdIOUtils._socketType(object._nativeSocket)) { |
| - case _STDIO_HANDLE_TYPE_TERMINAL: return StdioType.TERMINAL; |
| - case _STDIO_HANDLE_TYPE_PIPE: return StdioType.PIPE; |
| - case _STDIO_HANDLE_TYPE_FILE: return StdioType.FILE; |
| + int socketType = _StdIOUtils._socketType(object); |
| + if (socketType != null) { |
|
Florian Schneider
2016/05/09 09:05:15
Why is this null-check necessary?
floitsch
2016/05/09 12:48:01
Because it returns `null` if the object is not a `
Florian Schneider
2016/05/09 13:39:43
Ok, but in case of null the switch would be skippe
floitsch
2016/05/09 14:21:32
Changed it so that it directly returns StdioType.O
|
| + switch (socketType) { |
| + case _STDIO_HANDLE_TYPE_TERMINAL: |
| + return StdioType.TERMINAL; |
| + case _STDIO_HANDLE_TYPE_PIPE: |
| + return StdioType.PIPE; |
| + case _STDIO_HANDLE_TYPE_FILE: |
| + return StdioType.FILE; |
| + } |
| } |
| } |
| - if (object is IOSink) { |
| + if (object is _IOSinkImpl) { |
| try { |
| if (object._target is _FileStreamConsumer) { |
| return StdioType.FILE; |
| @@ -350,6 +356,6 @@ StdioType stdioType(object) { |
| class _StdIOUtils { |
| external static _getStdioOutputStream(int fd); |
| external static Stdin _getStdioInputStream(); |
| - external static int _socketType(nativeSocket); |
| + external static int _socketType(Socket socket); |
| external static _getStdioHandleType(int fd); |
| } |