summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBrandon Diamond <brandon@10gen.com>2011-11-29 17:33:07 -0500
committerBrandon Diamond <brandon@10gen.com>2011-11-29 17:33:07 -0500
commite9649e05cede70bf83fccf15e2bf209c659a722a (patch)
treea5b970fe9f8d4f99cc632bcd309fc004e46b4b63 /tools
parent903de55aa10446ec8bcb19efa4ac9bfe8ab688f9 (diff)
downloadmongo-e9649e05cede70bf83fccf15e2bf209c659a722a.tar.gz
SERVER-3112: Improved stdout/err in mongoexport
Diffstat (limited to 'tools')
-rw-r--r--tools/export.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/export.cpp b/tools/export.cpp
index 0837ccf188a..0d9f0225da0 100644
--- a/tools/export.cpp
+++ b/tools/export.cpp
@@ -45,6 +45,15 @@ public:
_usesstdout = false;
}
+ virtual void preSetup() {
+ string out = getParam("out");
+ if ( out == "-" ) {
+ // write output to standard error to avoid mangling output
+ // must happen early to avoid sending junk to stdout
+ useStandardOutput(false);
+ }
+ }
+
virtual void printExtraHelp( ostream & out ) {
out << "Export MongoDB data to CSV, TSV or JSON files.\n" << endl;
}