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 2017/02/15 21:40:38 UTC

[2/7] mesos git commit: Added platform-independent constants `DEV_NULL` and `TRUE_COMMAND`.

Added platform-independent constants `DEV_NULL` and `TRUE_COMMAND`.

The `DEV_NULL` constant points to `/dev/null` on Posix and `NUL` on
Windows.  In both platforms, it can be used to redirect output
into digital oblivion.

The `TRUE_COMMAND` is a test constant that equals the `true` shell
command on Posix.  On Windows, we emulate this command by invoking
a shell with an inline command to exit with a successful exit code.

Review: https://reviews.apache.org/r/55546/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/ddad179e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/ddad179e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/ddad179e

Branch: refs/heads/master
Commit: ddad179ec88a2694d6d63afc3b53db4ac7b3c361
Parents: bd5c868
Author: Alex Clemmer <cl...@gmail.com>
Authored: Tue Feb 14 13:16:59 2017 -0800
Committer: Joseph Wu <jo...@apache.org>
Committed: Wed Feb 15 13:40:19 2017 -0800

----------------------------------------------------------------------
 3rdparty/stout/include/stout/gtest.hpp        | 7 +++++++
 3rdparty/stout/include/stout/os/constants.hpp | 6 ++++++
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/ddad179e/3rdparty/stout/include/stout/gtest.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/gtest.hpp b/3rdparty/stout/include/stout/gtest.hpp
index a004a37..763fd7b 100644
--- a/3rdparty/stout/include/stout/gtest.hpp
+++ b/3rdparty/stout/include/stout/gtest.hpp
@@ -230,6 +230,13 @@ template <typename T1, typename T2>
 #endif // __WINDOWS__
 
 
+#ifndef __WINDOWS__
+constexpr char TRUE_COMMAND[] = "true";
+#else
+constexpr char TRUE_COMMAND[] = "cmd /c exit 0";
+#endif // __WINDOWS__
+
+
 inline ::testing::AssertionResult AssertExited(
     const char* actualExpr,
     const int actual)

http://git-wip-us.apache.org/repos/asf/mesos/blob/ddad179e/3rdparty/stout/include/stout/os/constants.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/os/constants.hpp b/3rdparty/stout/include/stout/os/constants.hpp
index c71d52e..f20041c 100644
--- a/3rdparty/stout/include/stout/os/constants.hpp
+++ b/3rdparty/stout/include/stout/os/constants.hpp
@@ -26,6 +26,12 @@ constexpr char PATH_SEPARATOR = POSIX_PATH_SEPARATOR;
 constexpr char PATH_SEPARATOR = WINDOWS_PATH_SEPARATOR;
 #endif // __WINDOWS__
 
+#ifndef __WINDOWS__
+constexpr char DEV_NULL[] = "/dev/null";
+#else
+constexpr char DEV_NULL[] = "NUL";
+#endif // __WINDOWS__
+
 } // namespace os {
 
 #endif // __STOUT_OS_CONSTANTS_HPP__