You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by an...@apache.org on 2018/05/02 01:38:24 UTC
[24/31] mesos git commit: Fixed `Subprocess::ChildHook::CHDIR()` to
use `os::chdir()`.
Fixed `Subprocess::ChildHook::CHDIR()` to use `os::chdir()`.
This needed to use the Stout API so that the correct Windows
implementation is used, as `::chdir` is part of the CRT.
Also included used but not included `stout/os/*` headers.
Review: https://reviews.apache.org/r/66443
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d9edabe4
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d9edabe4
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d9edabe4
Branch: refs/heads/master
Commit: d9edabe43190c4973b485005f5aa8ac3950dec8a
Parents: b5f8769
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Tue Apr 3 14:28:13 2018 -0700
Committer: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Committed: Tue May 1 18:36:04 2018 -0700
----------------------------------------------------------------------
3rdparty/libprocess/src/subprocess.cpp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/d9edabe4/3rdparty/libprocess/src/subprocess.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/subprocess.cpp b/3rdparty/libprocess/src/subprocess.cpp
index 8983263..42e06da 100644
--- a/3rdparty/libprocess/src/subprocess.cpp
+++ b/3rdparty/libprocess/src/subprocess.cpp
@@ -40,6 +40,12 @@
#include <stout/strings.hpp>
#include <stout/try.hpp>
+#include <stout/os/chdir.hpp>
+#include <stout/os/close.hpp>
+#include <stout/os/dup.hpp>
+#include <stout/os/fcntl.hpp>
+#include <stout/os/signals.hpp>
+
#ifdef __WINDOWS__
#include "subprocess_windows.hpp"
#else
@@ -70,8 +76,9 @@ Subprocess::ChildHook Subprocess::ChildHook::CHDIR(
const std::string& working_directory)
{
return Subprocess::ChildHook([working_directory]() -> Try<Nothing> {
- if (::chdir(working_directory.c_str()) == -1) {
- return Error("Could not chdir");
+ const Try<Nothing> result = os::chdir(working_directory);
+ if (result.isError()) {
+ return Error(result.error());
}
return Nothing();