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

Unified Diff: mojo/runner/child_process_host.cc

Issue 1419293003: Allow mojo_runner to connect to arbitrary executables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 2 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
« no previous file with comments | « mojo/runner/child_process_host.h ('k') | mojo/runner/in_process_native_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/runner/child_process_host.cc
diff --git a/mojo/runner/child_process_host.cc b/mojo/runner/child_process_host.cc
index d6f0c3d2bdcc7fe1d287d98d1ff4740a25f49bbb..b485671fcf18b2cbf931d1e602cc878eb9060925 100644
--- a/mojo/runner/child_process_host.cc
+++ b/mojo/runner/child_process_host.cc
@@ -103,9 +103,18 @@ void ChildProcessHost::DidStart() {
void ChildProcessHost::DoLaunch() {
const base::CommandLine* parent_command_line =
base::CommandLine::ForCurrentProcess();
- base::CommandLine child_command_line(parent_command_line->GetProgram());
+ base::FilePath target_path = parent_command_line->GetProgram();
+ // |app_path_| can be empty in tests.
+ if (!app_path_.MatchesExtension(FILE_PATH_LITERAL(".mojo")) &&
+ !app_path_.empty()) {
+ target_path = app_path_;
+ }
+
+ base::CommandLine child_command_line(target_path);
child_command_line.AppendArguments(*parent_command_line, false);
- child_command_line.AppendSwitchPath(switches::kChildProcess, app_path_);
+
+ if (target_path != app_path_)
+ child_command_line.AppendSwitchPath(switches::kChildProcess, app_path_);
if (start_sandboxed_)
child_command_line.AppendSwitch(switches::kEnableSandbox);
« no previous file with comments | « mojo/runner/child_process_host.h ('k') | mojo/runner/in_process_native_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698