diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 18:24:38 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 18:24:38 +0000 |
commit | 13081fccbf907aef8476c94d904fc94d6c59a206 (patch) | |
tree | 9470fa1206aba0c8b41ad569a019c7ad484ab7ab /base | |
parent | 815d63d9f1c68ffa056ad2c2c8fee34f0d0b70b8 (diff) | |
download | chromium_src-13081fccbf907aef8476c94d904fc94d6c59a206.zip chromium_src-13081fccbf907aef8476c94d904fc94d6c59a206.tar.gz chromium_src-13081fccbf907aef8476c94d904fc94d6c59a206.tar.bz2 |
PrependWrapper is platform-specific, so it should take a platform string.
Though the comments said it was POSIX only, I see it used on Windows as
well so I'm updating the comment.
Review URL: http://codereview.chromium.org/3030043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54933 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/command_line.cc | 5 | ||||
-rw-r--r-- | base/command_line.h | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/base/command_line.cc b/base/command_line.cc index e180ddf..8d36e16 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -432,6 +432,8 @@ void CommandLine::AppendArguments(const CommandLine& other, } void CommandLine::PrependWrapper(const std::wstring& wrapper) { + if (wrapper.empty()) + return; // The wrapper may have embedded arguments (like "gdb --args"). In this case, // we don't pretend to do anything fancy, we just split on spaces. std::vector<std::wstring> wrapper_and_args; @@ -475,10 +477,9 @@ void CommandLine::AppendArguments(const CommandLine& other, switches_[i->first] = i->second; } -void CommandLine::PrependWrapper(const std::wstring& wrapper_wide) { +void CommandLine::PrependWrapper(const std::string& wrapper) { // The wrapper may have embedded arguments (like "gdb --args"). In this case, // we don't pretend to do anything fancy, we just split on spaces. - const std::string wrapper = base::SysWideToNativeMB(wrapper_wide); std::vector<std::string> wrapper_and_args; SplitString(wrapper, ' ', &wrapper_and_args); argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end()); diff --git a/base/command_line.h b/base/command_line.h index 2178bdf..331add9 100644 --- a/base/command_line.h +++ b/base/command_line.h @@ -173,9 +173,9 @@ class CommandLine { void AppendArguments(const CommandLine& other, bool include_program); - // On POSIX systems it's common to run processes via a wrapper (like - // "valgrind" or "gdb --args"). - void PrependWrapper(const std::wstring& wrapper); + // Insert a command before the current command. Common for debuggers, + // like "valgrind" or "gdb --args". + void PrependWrapper(const StringType& wrapper); // Copy a set of switches (and their values, if any) from another command // line. Commonly used when launching a subprocess. |