Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Unified Diff: runtime/bin/socket_win.cc

Issue 8574002: Handle stdin/stdout/stderr on Windows (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments from ager@ Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/socket_macos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_win.cc
diff --git a/runtime/bin/socket_win.cc b/runtime/bin/socket_win.cc
index a7d60398c27607f932e4e252821eac7a0f7b41e1..f13e0e8efd199183407c03b12e2ef6bd67714c46 100644
--- a/runtime/bin/socket_win.cc
+++ b/runtime/bin/socket_win.cc
@@ -87,6 +87,31 @@ intptr_t Socket::CreateConnect(const char* host, const intptr_t port) {
}
+intptr_t Socket::GetStdioHandle(int num) {
+ HANDLE handle;
+ switch (num) {
+ case 0:
+ handle = GetStdHandle(STD_INPUT_HANDLE);
+ break;
+ case 1:
+ handle = GetStdHandle(STD_OUTPUT_HANDLE);
+ break;
+ case 2:
+ handle = GetStdHandle(STD_ERROR_HANDLE);
+ break;
+ default: UNREACHABLE();
+ }
+ if (handle == INVALID_HANDLE_VALUE) {
+ fprintf(stderr, "Error GetStdHandle: %d\n", GetLastError());
+ return -1;
+ }
+ FileHandle* file_handle = new FileHandle(handle);
+ if (file_handle == NULL) return -1;
+ file_handle->MarkDoesNotSupportOverlappedIO();
+ return reinterpret_cast<intptr_t>(file_handle);
+}
+
+
intptr_t ServerSocket::Accept(intptr_t fd) {
ListenSocket* listen_socket = reinterpret_cast<ListenSocket*>(fd);
ClientSocket* client_socket = listen_socket->Accept();
« no previous file with comments | « runtime/bin/socket_macos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698