You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2016/12/10 02:02:09 UTC
[02/12] mesos git commit: Windows: Qualified string, map,
and vector in `subprocess.hpp`.
Windows: Qualified string, map, and vector in `subprocess.hpp`.
This fixes compilation errors introduced by:
https://reviews.apache.org/r/54555/
The above review removed `using std::map, std::string, std::vector`
but did not add the `std::` qualification to their uses.
Review: https://reviews.apache.org/r/54610/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/a430a651
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/a430a651
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/a430a651
Branch: refs/heads/master
Commit: a430a65147c337bf4db40a3125a0a59abbe02303
Parents: 8a6bdb8
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Fri Dec 9 15:54:48 2016 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Fri Dec 9 18:01:31 2016 -0800
----------------------------------------------------------------------
.../include/process/windows/subprocess.hpp | 33 +++++++++++---------
1 file changed, 19 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/a430a651/3rdparty/libprocess/include/process/windows/subprocess.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/windows/subprocess.hpp b/3rdparty/libprocess/include/process/windows/subprocess.hpp
index ae684ff..3bc7f19 100644
--- a/3rdparty/libprocess/include/process/windows/subprocess.hpp
+++ b/3rdparty/libprocess/include/process/windows/subprocess.hpp
@@ -68,12 +68,12 @@ inline void close(
// Retrieves system environment in a `std::map`, ignoring
// the current process's environment variables.
-inline Option<map<string, string>> getSystemEnvironment()
+inline Option<std::map<std::string, std::string>> getSystemEnvironment()
{
std::wstring_convert<std::codecvt<wchar_t, char, mbstate_t>,
wchar_t> converter;
- map<string, string> systemEnvironment;
+ std::map<std::string, std::string> systemEnvironment;
wchar_t* environmentEntry = nullptr;
// Get the system environment.
@@ -129,27 +129,32 @@ inline Option<map<string, string>> getSystemEnvironment()
// `env` and are generally necessary in order to launch things on Windows.
//
// [1] https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
-inline Option<string> createProcessEnvironment(
- const Option<map<string, string>>& env)
+inline Option<std::string> createProcessEnvironment(
+ const Option<std::map<std::string, std::string>>& env)
{
if (env.isNone() || (env.isSome() && env.get().size() == 0)) {
return None();
}
- Option<map<string, string>> systemEnvironment = getSystemEnvironment();
+ Option<std::map<std::string, std::string>> systemEnvironment =
+ getSystemEnvironment();
// The system environment must be non-empty.
// No subprocesses will be able to launch if the system environment is blank.
CHECK(systemEnvironment.isSome() && systemEnvironment.get().size() > 0);
- map<string, string> combinedEnvironment = env.get();
+ std::map<std::string, std::string> combinedEnvironment = env.get();
- foreachpair(const string& key, const string& value, systemEnvironment.get()) {
+ foreachpair (const std::string& key,
+ const std::string& value,
+ systemEnvironment.get()) {
combinedEnvironment[key] = value;
}
- string environmentString;
- foreachpair (const string& key, const string& value, combinedEnvironment) {
+ std::string environmentString;
+ foreachpair (const std::string& key,
+ const std::string& value,
+ combinedEnvironment) {
environmentString += key + '=' + value + '\0';
}
@@ -158,15 +163,15 @@ inline Option<string> createProcessEnvironment(
inline Try<PROCESS_INFORMATION> createChildProcess(
- const string& path,
- const vector<string>& argv,
- const Option<map<string, string>>& environment,
+ const std::string& path,
+ const std::vector<std::string>& argv,
+ const Option<std::map<std::string, std::string>>& environment,
const InputFileDescriptors stdinfds,
const OutputFileDescriptors stdoutfds,
const OutputFileDescriptors stderrfds)
{
// Construct the environment that will be passed to `CreateProcess`.
- Option<string> environmentString = createProcessEnvironment(environment);
+ Option<std::string> environmentString = createProcessEnvironment(environment);
const char* processEnvironment = environmentString.isNone()
? nullptr
: environmentString.get().c_str();
@@ -196,7 +201,7 @@ inline Try<PROCESS_INFORMATION> createChildProcess(
// to have been already quoted correctly before we generate `command`.
// Incorrectly-quoted command arguments will probably lead the child process
// to terminate with an error. See also NOTE on `process::subprocess`.
- string command = strings::join(" ", argv);
+ std::string command = strings::join(" ", argv);
// Escape the quotes in `command`.
//