summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-08-14 11:06:10 -0400
committerEliot Horowitz <eliot@10gen.com>2009-08-14 11:06:10 -0400
commit115e9e42e1d78813fb65834769e58fcfbf7e9732 (patch)
tree490d4331ee1fe1f69adf768eb36e0a0d79ff147d
parent974d71012896ee863b505b8d9c891e1f7f82f6d1 (diff)
downloadmongo-115e9e42e1d78813fb65834769e58fcfbf7e9732.tar.gz
better file handling in shell
-rw-r--r--scripting/engine.cpp11
-rw-r--r--shell/dbshell.cpp4
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;
}
}