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

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

Issue 9108008: Add optional workingDirectory argument to Process.start. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #include <process.h> 5 #include <process.h>
6 6
7 #include "bin/builtin.h" 7 #include "bin/builtin.h"
8 #include "bin/globals.h" 8 #include "bin/globals.h"
9 #include "bin/process.h" 9 #include "bin/process.h"
10 #include "bin/eventhandler.h" 10 #include "bin/eventhandler.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 if (!ok || written != sizeof(message)) { 222 if (!ok || written != sizeof(message)) {
223 fprintf(stderr, "WriteFile failed %d\n", GetLastError()); 223 fprintf(stderr, "WriteFile failed %d\n", GetLastError());
224 } 224 }
225 return 0; 225 return 0;
226 } 226 }
227 227
228 228
229 int Process::Start(const char* path, 229 int Process::Start(const char* path,
230 char* arguments[], 230 char* arguments[],
231 intptr_t arguments_length, 231 intptr_t arguments_length,
232 const char* working_directory,
232 intptr_t* in, 233 intptr_t* in,
233 intptr_t* out, 234 intptr_t* out,
234 intptr_t* err, 235 intptr_t* err,
235 intptr_t* id, 236 intptr_t* id,
236 intptr_t* exit_handler, 237 intptr_t* exit_handler,
237 char* os_error_message, 238 char* os_error_message,
238 int os_error_message_len) { 239 int os_error_message_len) {
239 HANDLE stdin_handles[2] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE }; 240 HANDLE stdin_handles[2] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE };
240 HANDLE stdout_handles[2] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE }; 241 HANDLE stdout_handles[2] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE };
241 HANDLE stderr_handles[2] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE }; 242 HANDLE stderr_handles[2] = { INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE };
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 340 }
340 341
341 // Create process. 342 // Create process.
342 BOOL result = CreateProcess(NULL, // ApplicationName 343 BOOL result = CreateProcess(NULL, // ApplicationName
343 command_line, 344 command_line,
344 NULL, // ProcessAttributes 345 NULL, // ProcessAttributes
345 NULL, // ThreadAttributes 346 NULL, // ThreadAttributes
346 TRUE, // InheritHandles 347 TRUE, // InheritHandles
347 0, // CreationFlags 348 0, // CreationFlags
348 NULL, // Environment 349 NULL, // Environment
349 NULL, // CurrentDirectory, 350 working_directory,
350 &startup_info, 351 &startup_info,
351 &process_info); 352 &process_info);
352 353
353 // Deallocate command-line string. 354 // Deallocate command-line string.
354 delete[] command_line; 355 delete[] command_line;
355 356
356 if (result == 0) { 357 if (result == 0) {
357 int error_code = SetOsErrorMessage(os_error_message, os_error_message_len); 358 int error_code = SetOsErrorMessage(os_error_message, os_error_message_len);
358 CloseProcessPipes( 359 CloseProcessPipes(
359 stdin_handles, stdout_handles, stderr_handles, exit_handles); 360 stdin_handles, stdout_handles, stderr_handles, exit_handles);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 return false; 405 return false;
405 } 406 }
406 } 407 }
407 return true; 408 return true;
408 } 409 }
409 410
410 411
411 void Process::Exit(intptr_t id) { 412 void Process::Exit(intptr_t id) {
412 RemoveProcess(id); 413 RemoveProcess(id);
413 } 414 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698