You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2013/05/26 18:57:30 UTC
[05/28] git commit: Minor cleanup in stout/exit.hpp.
Minor cleanup in stout/exit.hpp.
Review: https://reviews.apache.org/r/11269
Project: http://git-wip-us.apache.org/repos/asf/incubator-mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mesos/commit/07c44ce2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mesos/tree/07c44ce2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mesos/diff/07c44ce2
Branch: refs/heads/master
Commit: 07c44ce216d96ecdc1a639ec489d30590308e9af
Parents: 65e2fba
Author: Benjamin Hindman <be...@twitter.com>
Authored: Sat May 4 12:09:42 2013 -0700
Committer: Benjamin Hindman <be...@twitter.com>
Committed: Fri May 24 22:05:05 2013 -0700
----------------------------------------------------------------------
.../third_party/stout/include/stout/exit.hpp | 17 ++++++++-------
1 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mesos/blob/07c44ce2/third_party/libprocess/third_party/stout/include/stout/exit.hpp
----------------------------------------------------------------------
diff --git a/third_party/libprocess/third_party/stout/include/stout/exit.hpp b/third_party/libprocess/third_party/stout/include/stout/exit.hpp
index c588ac0..e8da726 100644
--- a/third_party/libprocess/third_party/stout/include/stout/exit.hpp
+++ b/third_party/libprocess/third_party/stout/include/stout/exit.hpp
@@ -3,34 +3,35 @@
#include <stdlib.h>
+#include <iostream> // For std::cerr.
#include <ostream>
#include <sstream>
#include <string>
-// Exit takes an exit code and provides a stream for output prior to
+// Exit takes an exit status and provides a stream for output prior to
// exiting. This is like glog's LOG(FATAL) or CHECK, except that it
-// does _not_ print a stack trace because we don't want to freak out
-// the user.
+// does _not_ print a stack trace.
//
// Ex: EXIT(1) << "Cgroups are not present in this system.";
-#define EXIT __Exit().stream
+#define EXIT(status) __Exit(status).stream()
struct __Exit
{
+ __Exit(int _status) : status(_status) {}
+
~__Exit()
{
std::cerr << out.str() << std::endl;
- exit(exitCode);
+ exit(status);
}
- std::ostream& stream(int exitCode)
+ std::ostream& stream()
{
- this->exitCode = exitCode;
return out;
}
std::ostringstream out;
- int exitCode;
+ const int status;
};
#endif // __STOUT_EXIT_HPP__