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

Side by Side Diff: runtime/bin/process.cc

Issue 2791423002: [dart:io] Don't close stdin with a socket finalizer (Closed)
Patch Set: Windows 7 fix Created 3 years, 8 months 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 unified diff | Download patch
OLDNEW
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 #if !defined(DART_IO_DISABLED) 5 #if !defined(DART_IO_DISABLED)
6 6
7 #include "bin/process.h" 7 #include "bin/process.h"
8 8
9 #include "bin/dartutils.h" 9 #include "bin/dartutils.h"
10 #include "bin/io_buffer.h" 10 #include "bin/io_buffer.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 Dart_Handle exit_handle = Dart_GetNativeArgument(args, 9); 154 Dart_Handle exit_handle = Dart_GetNativeArgument(args, 9);
155 intptr_t pid = -1; 155 intptr_t pid = -1;
156 char* os_error_message = NULL; // Scope allocated by Process::Start. 156 char* os_error_message = NULL; // Scope allocated by Process::Start.
157 157
158 int error_code = Process::Start( 158 int error_code = Process::Start(
159 path, string_args, args_length, working_directory, string_environment, 159 path, string_args, args_length, working_directory, string_environment,
160 environment_length, static_cast<ProcessStartMode>(mode), &process_stdout, 160 environment_length, static_cast<ProcessStartMode>(mode), &process_stdout,
161 &process_stdin, &process_stderr, &pid, &exit_event, &os_error_message); 161 &process_stdin, &process_stderr, &pid, &exit_event, &os_error_message);
162 if (error_code == 0) { 162 if (error_code == 0) {
163 if (mode != kDetached) { 163 if (mode != kDetached) {
164 Socket::SetSocketIdNativeField(stdin_handle, process_stdin, false); 164 Socket::SetSocketIdNativeField(stdin_handle, process_stdin,
165 Socket::SetSocketIdNativeField(stdout_handle, process_stdout, false); 165 Socket::kFinalizerNormal);
166 Socket::SetSocketIdNativeField(stderr_handle, process_stderr, false); 166 Socket::SetSocketIdNativeField(stdout_handle, process_stdout,
167 Socket::kFinalizerNormal);
168 Socket::SetSocketIdNativeField(stderr_handle, process_stderr,
169 Socket::kFinalizerNormal);
167 } 170 }
168 if (mode == kNormal) { 171 if (mode == kNormal) {
169 Socket::SetSocketIdNativeField(exit_handle, exit_event, false); 172 Socket::SetSocketIdNativeField(exit_handle, exit_event,
173 Socket::kFinalizerNormal);
170 } 174 }
171 Process::SetProcessIdNativeField(process, pid); 175 Process::SetProcessIdNativeField(process, pid);
172 } else { 176 } else {
173 result = 177 result =
174 DartUtils::SetIntegerField(status_handle, "_errorCode", error_code); 178 DartUtils::SetIntegerField(status_handle, "_errorCode", error_code);
175 if (Dart_IsError(result)) { 179 if (Dart_IsError(result)) {
176 Dart_PropagateError(result); 180 Dart_PropagateError(result);
177 } 181 }
178 result = DartUtils::SetStringField(status_handle, "_errorMessage", 182 result = DartUtils::SetStringField(status_handle, "_errorMessage",
179 os_error_message != NULL 183 os_error_message != NULL
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 if (!Dart_IsError(external_array)) { 363 if (!Dart_IsError(external_array)) {
360 memmove(buffer, system_string, system_len); 364 memmove(buffer, system_string, system_len);
361 } 365 }
362 Dart_SetReturnValue(args, external_array); 366 Dart_SetReturnValue(args, external_array);
363 } 367 }
364 368
365 } // namespace bin 369 } // namespace bin
366 } // namespace dart 370 } // namespace dart
367 371
368 #endif // !defined(DART_IO_DISABLED) 372 #endif // !defined(DART_IO_DISABLED)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698