From 9eaaef4a6c665a0cd19f6ff5ffc7295537a11619 Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 3 Feb 2010 00:06:06 -0800 Subject: [PATCH] only return tail ov raw mongo program output if very long --- shell/utils.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shell/utils.cpp b/shell/utils.cpp index 7ec5ccfe5c4..7c43ee7b5e3 100644 --- a/shell/utils.cpp +++ b/shell/utils.cpp @@ -197,9 +197,14 @@ namespace mongo { mongoProgramOutput_ << buf.str() << endl; } + // only returns last 10000 characters BSONObj RawMongoProgramOutput( const BSONObj &args ) { boost::mutex::scoped_lock lk( mongoProgramOutputMutex ); - return BSON( "" << mongoProgramOutput_.str() ); + string out = mongoProgramOutput_.str(); + size_t len = out.length(); + if ( len > 10000 ) + out = out.substr( len - 10000, 10000 ); + return BSON( "" << out ); } class MongoProgramRunner {