summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-06-11 20:27:07 -0400
committerEliot Horowitz <eliot@10gen.com>2009-06-11 20:27:07 -0400
commita4a895e1f064b25512a9e1450f6866d1430512d7 (patch)
tree4fbc8a5d7376f37f40862d7d1c2e887516be5adf
parent8b6145546a99951e4b47ca45ed2c2cb23406da96 (diff)
downloadmongo-a4a895e1f064b25512a9e1450f6866d1430512d7.tar.gz
fix shell printing
-rw-r--r--scripting/engine_spidermonkey.cpp3
-rw-r--r--shell/dbshell.cpp6
2 files changed, 7 insertions, 2 deletions
diff --git a/scripting/engine_spidermonkey.cpp b/scripting/engine_spidermonkey.cpp
index 77ecc06573d..481be661261 100644
--- a/scripting/engine_spidermonkey.cpp
+++ b/scripting/engine_spidermonkey.cpp
@@ -980,6 +980,9 @@ namespace mongo {
// already printed in reportError, so... TODO
}
+ if ( worked )
+ _convertor->setProperty( _global , "__lastres__" , ret );
+
if ( worked && printResult && ! JSVAL_IS_VOID( ret ) )
cout << _convertor->toString( ret ) << endl;
diff --git a/shell/dbshell.cpp b/shell/dbshell.cpp
index 23ea1260567..8db5bde907c 100644
--- a/shell/dbshell.cpp
+++ b/shell/dbshell.cpp
@@ -321,8 +321,10 @@ int main(int argc, char* argv[]) {
}
- if ( ! wascmd )
- scope->exec( code.c_str() , "(shell)" , true , true , false );
+ if ( ! wascmd ){
+ scope->exec( code.c_str() , "(shell)" , false , true , false );
+ scope->exec( "shellPrintHelper( __lastres__ );" , "(shell2)" , true , true , false );
+ }
shellHistoryAdd( line );