summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2014-10-01 14:32:38 -0400
committerBenety Goh <benety@mongodb.com>2014-10-01 14:32:38 -0400
commitf9ead899683b5baa7822b448defd0fbdd88c4e1b (patch)
treeec79727e3e25c9df8e7884ba0f7305d676b11817
parent55097afd011278c9274b778a2bce45b170ba2bab (diff)
downloadmongo-f9ead899683b5baa7822b448defd0fbdd88c4e1b.tar.gz
SERVER-15484 flush stdout before exiting Shim::doRun()
-rw-r--r--src/mongo/tools/shim.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/tools/shim.cpp b/src/mongo/tools/shim.cpp
index 994ffe27c41..88d90b8ac43 100644
--- a/src/mongo/tools/shim.cpp
+++ b/src/mongo/tools/shim.cpp
@@ -52,6 +52,7 @@
#include "mongo/tools/tool_logger.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/options_parser/option_section.h"
+#include "mongo/util/scopeguard.h"
using std::auto_ptr;
using std::ios_base;
@@ -123,6 +124,10 @@ public:
}
int doRun() {
+ // Flush stdout before returning from doRun().
+ // XXX: This seems to be an issue under RHEL55 but not under other OSes or more recent
+ // versions of Linux
+ ON_BLOCK_EXIT(&std::ostream::flush, &cout);
try {
_ns = getNS();