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

Unified Diff: runtime/bin/process.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, 12 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/process.cc
===================================================================
--- runtime/bin/process.cc (revision 2981)
+++ runtime/bin/process.cc (working copy)
@@ -14,7 +14,7 @@
intptr_t out;
intptr_t err;
intptr_t exit_event;
- Dart_Handle status_handle = Dart_GetNativeArgument(args, 7);
+ Dart_Handle status_handle = Dart_GetNativeArgument(args, 8);
Dart_Handle path_handle = Dart_GetNativeArgument(args, 1);
// The Dart code verifies that the path implements the String
// interface. However, only builtin Strings are handled by
@@ -53,16 +53,31 @@
}
string_args[i] = const_cast<char *>(DartUtils::GetStringValue(arg));
}
- Dart_Handle in_handle = Dart_GetNativeArgument(args, 3);
- Dart_Handle out_handle = Dart_GetNativeArgument(args, 4);
- Dart_Handle err_handle = Dart_GetNativeArgument(args, 5);
- Dart_Handle exit_handle = Dart_GetNativeArgument(args, 6);
+ Dart_Handle working_directory_handle = Dart_GetNativeArgument(args, 3);
+ // Default to the current working directoy.
Søren Gjesse 2012/01/05 09:30:47 Default => Defaults
Anders Johnsen 2012/01/05 09:50:49 Done.
+ const char* working_directory = NULL;
+ if (Dart_IsString(working_directory_handle)) {
+ working_directory = DartUtils::GetStringValue(working_directory_handle);
+ } else if (!Dart_IsNull(working_directory_handle)) {
+ delete[] string_args;
+ DartUtils::SetIntegerInstanceField(status_handle, "_errorCode", 0);
+ DartUtils::SetStringInstanceField(
+ status_handle, "_errorMessage",
+ "WorkingDirectory must be a builtin string");
+ Dart_SetReturnValue(args, Dart_NewBoolean(false));
+ Dart_ExitScope();
+ return;
+ }
+ Dart_Handle in_handle = Dart_GetNativeArgument(args, 4);
+ Dart_Handle out_handle = Dart_GetNativeArgument(args, 5);
+ Dart_Handle err_handle = Dart_GetNativeArgument(args, 6);
+ Dart_Handle exit_handle = Dart_GetNativeArgument(args, 7);
intptr_t pid = -1;
static const int kMaxChildOsErrorMessageLength = 256;
char os_error_message[kMaxChildOsErrorMessageLength];
int error_code = Process::Start(
- path, string_args, length,
+ path, string_args, length, working_directory,
&in, &out, &err, &pid, &exit_event,
os_error_message, kMaxChildOsErrorMessageLength);
if (error_code == 0) {
« no previous file with comments | « runtime/bin/process.h ('k') | runtime/bin/process.dart » ('j') | runtime/bin/process.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698