summaryrefslogtreecommitdiff
path: root/indra/llcommon/llprocess.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-01-27 23:46:00 -0500
committerNat Goodspeed <nat@lindenlab.com>2012-01-27 23:46:00 -0500
commit27df0a84564d3a886661aae0faae74c2157cd31b (patch)
treec025f58c1491f888b630ab01ef54c298e15c437d /indra/llcommon/llprocess.cpp
parent61e98256df80822f9504a2037d5cbb029c39506d (diff)
On Windows, only quote LLProcess arguments if they seem to need it.
On Posix platforms, the OS argument mechanism makes quoting/reparsing unnecessary anyway, so this only affects Windows. Add optional 'triggers' parameter to LLStringUtils::quote() (default: space and double-quote). Only if the passed string contains a character in 'triggers' will it be double-quoted. This is observed to fix a Windows-specific problem in which plugin child process would fail to start because it wasn't expecting a quoted number. Use LLStringUtils::quote() more consistently in LLProcess implementation for logging.
Diffstat (limited to 'indra/llcommon/llprocess.cpp')
-rw-r--r--indra/llcommon/llprocess.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp
index 2c7512419d..2b7a534fb3 100644
--- a/indra/llcommon/llprocess.cpp
+++ b/indra/llcommon/llprocess.cpp
@@ -87,12 +87,12 @@ std::ostream& operator<<(std::ostream& out, const LLProcess::Params& params)
std::string cwd(params.cwd);
if (! cwd.empty())
{
- out << "cd '" << cwd << "': ";
+ out << "cd " << LLStringUtil::quote(cwd) << ": ";
}
- out << '"' << std::string(params.executable) << '"';
+ out << LLStringUtil::quote(params.executable);
BOOST_FOREACH(const std::string& arg, params.args)
{
- out << " \"" << arg << '"';
+ out << ' ' << LLStringUtil::quote(arg);
}
return out;
}
@@ -132,8 +132,8 @@ public:
if (! AssignProcessToJobObject(mJob, hProcess))
{
- LL_WARNS("LLProcess") << WindowsErrorString(STRINGIZE("AssignProcessToJobObject(\""
- << prog << "\")")) << LL_ENDL;
+ LL_WARNS("LLProcess") << WindowsErrorString(STRINGIZE("AssignProcessToJobObject("
+ << prog << ")")) << LL_ENDL;
}
}
@@ -206,7 +206,7 @@ void LLProcess::launch(const LLSDParamAdapter<Params>& params)
mProcessID = pinfo.hProcess;
CloseHandle(pinfo.hThread); // stops leaks - nothing else
- mDesc = STRINGIZE('"' << std::string(params.executable) << "\" (" << pinfo.dwProcessId << ')');
+ mDesc = STRINGIZE(LLStringUtil::quote(params.executable) << " (" << pinfo.dwProcessId << ')');
LL_INFOS("LLProcess") << "Launched " << params << " (" << pinfo.dwProcessId << ")" << LL_ENDL;
// Now associate the new child process with our Job Object -- unless
@@ -356,7 +356,7 @@ void LLProcess::launch(const LLSDParamAdapter<Params>& params)
// parent process
mProcessID = child;
- mDesc = STRINGIZE('"' << std::string(params.executable) << "\" (" << mProcessID << ')');
+ mDesc = STRINGIZE(LLStringUtil::quote(params.executable) << " (" << mProcessID << ')');
LL_INFOS("LLProcess") << "Launched " << params << " (" << mProcessID << ")" << LL_ENDL;
}