Index: runtime/bin/socket_macos.cc |
diff --git a/runtime/bin/socket_macos.cc b/runtime/bin/socket_macos.cc |
index b11da008c7b82dccab4105668470204d27e3dd14..ff1e28eca55dd7173e75592b9d948ae64eb1d9b9 100644 |
--- a/runtime/bin/socket_macos.cc |
+++ b/runtime/bin/socket_macos.cc |
@@ -143,9 +143,9 @@ void Socket::GetError(intptr_t fd, OSError* os_error) { |
int Socket::GetType(intptr_t fd) { |
struct stat buf; |
- if (isatty(fd)) return File::kTerminal; |
int result = fstat(fd, &buf); |
if (result == -1) return -1; |
+ if (S_ISCHR(buf.st_mode)) return File::kTerminal; |
if (S_ISFIFO(buf.st_mode)) return File::kPipe; |
if (S_ISREG(buf.st_mode)) return File::kFile; |
return File::kOther; |