diff options
-rw-r--r-- | scripting/engine.cpp | 11 | ||||
-rw-r--r-- | shell/dbshell.cpp | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/scripting/engine.cpp b/scripting/engine.cpp index d34b90aa578..d660392adfa 100644 --- a/scripting/engine.cpp +++ b/scripting/engine.cpp @@ -33,10 +33,17 @@ namespace mongo { assert( 0 ); return false; } - + + if ( ! exists( p ) ){ + cerr << "file [" << filename << "] doesn't exist" << endl; + if ( assertOnError ) + assert( 0 ); + return false; + } + File f; f.open( filename.c_str() ); - + fileofs L = f.len(); assert( L <= 0x7ffffffe ); char * data = (char*)malloc( (size_t) L+1 ); diff --git a/shell/dbshell.cpp b/shell/dbshell.cpp index 98e1e9b4b7a..f6208518d52 100644 --- a/shell/dbshell.cpp +++ b/shell/dbshell.cpp @@ -271,7 +271,11 @@ int _main(int argc, char* argv[]) { for (size_t i = 0; i < files.size(); i++) { mongo::shellUtils::MongoProgramScope s; + if ( files.size() > 1 ) + cout << "loading file: " << files[i] << endl; + if ( ! scope->execFile( files[i] , false , true , false ) ){ + cout << "failed to load: " << files[i] << endl; return -3; } } |