Repository: mesos Updated Branches: refs/heads/master 44cc1932c -> 1e514ca02
Windows: Implemented os::execvpe with _spawnvpe. Review: https://reviews.apache.org/r/52798 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/8c8ec608 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/8c8ec608 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/8c8ec608 Branch: refs/heads/master Commit: 8c8ec608503394575a4f99fd725010b8920e5efa Parents: 44cc193 Author: Joseph Wu <josep...@apache.org> Authored: Wed Oct 12 11:57:18 2016 -0700 Committer: Joseph Wu <josep...@apache.org> Committed: Wed Oct 12 14:41:29 2016 -0700 ---------------------------------------------------------------------- 3rdparty/stout/include/stout/os/windows/shell.hpp | 14 ++++++++++++++ 3rdparty/stout/include/stout/windows/os.hpp | 6 ------ 2 files changed, 14 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/8c8ec608/3rdparty/stout/include/stout/os/windows/shell.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/include/stout/os/windows/shell.hpp b/3rdparty/stout/include/stout/os/windows/shell.hpp index 0ababb4..17e3d56 100644 --- a/3rdparty/stout/include/stout/os/windows/shell.hpp +++ b/3rdparty/stout/include/stout/os/windows/shell.hpp @@ -149,6 +149,20 @@ inline int execvp(const char* file, char* const argv[]) } +// On Windows, the `_spawnvpe` call creates a new process. +// In order to emulate the semantics of `execvpe`, we spawn with `_P_WAIT`, +// which forces the parent process to block on the child. When the child exits, +// the exit code is propagated back through the parent via `exit()`. +// +// The returned value from `_spawnvpe` represents child exit code when +// `_P_WAIT` is used. +inline int execvpe(const char* file, char* const argv[], char* const envp[]) +{ + exit(static_cast<int>(::_spawnvpe(_P_WAIT, file, argv, envp))); + return 0; +} + + // Concatenates multiple command-line arguments and escapes the values. // If `arg` is not specified (or takes the value `0`), the function will // scan `argv` until a `nullptr` is encountered. http://git-wip-us.apache.org/repos/asf/mesos/blob/8c8ec608/3rdparty/stout/include/stout/windows/os.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/include/stout/windows/os.hpp b/3rdparty/stout/include/stout/windows/os.hpp index 7d6530e..7ca0b5d 100644 --- a/3rdparty/stout/include/stout/windows/os.hpp +++ b/3rdparty/stout/include/stout/windows/os.hpp @@ -374,12 +374,6 @@ inline std::string hstrerror(int err) } -// This function is a portable version of execvpe ('p' means searching -// executable from PATH and 'e' means setting environments). We add -// this function because it is not available on all systems. -inline int execvpe(const char* file, char** argv, char** envp) = delete; - - inline Try<Nothing> chown( uid_t uid, gid_t gid,