Repository: mesos Updated Branches: refs/heads/master ca21ca820 -> 896aee76c
Changed call from `os::shell()` to `os::system()`. The function `os::shell` is not implemented on Windows, making it necessary to either hide all calls behind a preprocessor macro or to avoid the function. Since we don't need the output of the child process, we just switch to `os::system`. Also, we included the missing header `<stout/os/write.hpp>`. Review: https://reviews.apache.org/r/66700/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/896aee76 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/896aee76 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/896aee76 Branch: refs/heads/master Commit: 896aee76c7b15db89feee511c2a67d5f7ce7535d Parents: ca21ca8 Author: Benno Evers <[email protected]> Authored: Wed Apr 18 16:21:49 2018 -0700 Committer: Andrew Schwartzmeyer <[email protected]> Committed: Wed Apr 18 17:21:47 2018 -0700 ---------------------------------------------------------------------- 3rdparty/libprocess/src/memory_profiler.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/896aee76/3rdparty/libprocess/src/memory_profiler.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/memory_profiler.cpp b/3rdparty/libprocess/src/memory_profiler.cpp index b2174ba..5d6e9dc 100644 --- a/3rdparty/libprocess/src/memory_profiler.cpp +++ b/3rdparty/libprocess/src/memory_profiler.cpp @@ -29,6 +29,8 @@ #include <stout/os.hpp> #include <stout/path.hpp> +#include <stout/os/write.hpp> + #include <glog/logging.h> using process::Future; @@ -307,22 +309,23 @@ Try<Nothing> generateJeprofFile( const string& outputPath) { // As jeprof doesn't have an option to specify an output file, we actually - // need `os::shell()` here instead of `os::spawn()`. + // cannot use `os::spawn()` here. // Note that the three parameters *MUST NOT* be controllable by the user // accessing the HTTP endpoints, otherwise arbitrary shell commands could be // trivially injected. // Apart from that, we dont need to be as careful here as with the actual // heap profile dump, because a failure will not crash the whole process. - Try<string> result = os::shell(strings::format( + Option<int> result = os::system(strings::format( "jeprof %s /proc/self/exe %s > %s", options, inputPath, outputPath).get()); - if (result.isError()) { + if (result.isNone()) { return Error( - "Error trying to run jeprof: " + result.error() + ". Please make sure" - " that jeprof is installed and that the input file contains data"); + "Error trying to run jeprof. Please make sure that jeprof is installed" + " and that the input file contains data. For more information, please" + " consult the log files of this process"); } return Nothing();
