diff --git a/pch.h b/pch.h index 998678df49b..3482f053857 100644 --- a/pch.h +++ b/pch.h @@ -34,6 +34,12 @@ # define _CRT_SECURE_NO_WARNINGS #endif +#if defined(WIN32) +// so you don't have to define this yourself as the code seems to use it... +#undef _WIN32 +#define _WIN32 +#endif + #if defined(_WIN32) # define NOMINMAX # include //this must be included before the first windows.h include diff --git a/scripting/engine_spidermonkey.cpp b/scripting/engine_spidermonkey.cpp index 46c8a8999b2..06c1b12f8ce 100644 --- a/scripting/engine_spidermonkey.cpp +++ b/scripting/engine_spidermonkey.cpp @@ -1488,9 +1488,14 @@ namespace mongo { }; + /* used to make the logging not overly chatty in the mongo shell. */ + bool isShell = false; + void errorReporter( JSContext *cx, const char *message, JSErrorReport *report ){ stringstream ss; - ss << "JS Error: " << message; + if( !isShell ) + ss << "JS Error: "; + ss << message; if ( report && report->filename ){ ss << " " << report->filename << ":" << report->lineno; diff --git a/shell/dbshell.cpp b/shell/dbshell.cpp index 963ad8b7ddf..224f362d077 100644 --- a/shell/dbshell.cpp +++ b/shell/dbshell.cpp @@ -358,7 +358,12 @@ bool fileExists( string file ){ } } +namespace mongo { + extern bool isShell; +} + int _main(int argc, char* argv[]) { + mongo::isShell = true; setupSignals(); mongo::shellUtils::RecordMyLocation( argv[ 0 ] ); diff --git a/shell/msvc/mongo.vcxproj b/shell/msvc/mongo.vcxproj index 131c5486ca9..a59e87efac5 100644 --- a/shell/msvc/mongo.vcxproj +++ b/shell/msvc/mongo.vcxproj @@ -53,7 +53,7 @@ Use Level3 Disabled - XP_WIN;_WIN32;PCRE_STATIC;HAVE_CONFIG_H;OLDJS;MONGO_EXPOSE_MACROS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + XP_WIN;PCRE_STATIC;HAVE_CONFIG_H;OLDJS;MONGO_EXPOSE_MACROS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) \boost\ pch.h 4355;4800;4267;4244;%(DisableSpecificWarnings) diff --git a/shell/servers.js b/shell/servers.js index a9d9bb0de3f..3015005d5bf 100644 --- a/shell/servers.js +++ b/shell/servers.js @@ -57,7 +57,7 @@ __nextPort = 27000; startMongodTest = function (port, dirname, restart) { if (!port) port = __nextPort++; - var f = startMongod; + var f = startMongodEmpty; if (restart) f = startMongodNoReset; if (!dirname) @@ -79,20 +79,19 @@ startMongodTest = function (port, dirname, restart) { // Start a mongod instance and return a 'Mongo' object connected to it. // This function's arguments are passed as command line arguments to mongod. -// The specified 'dbpath' is cleared if it exists, created if not. -startMongod = function(){ - // WARNING DELETES DATA DIRECTORY ON STARTUP THIS IS FOR TESTING - var args = createMongoArgs( "mongod" , arguments ); - - var dbpath = _parsePath.apply( null, args ); - resetDbpath( dbpath ); - - return startMongoProgram.apply( null, args ); +// The specified 'dbpath' is cleared if it exists, created if not. +startMongodEmpty = function () { + var args = createMongoArgs("mongod", arguments); + + var dbpath = _parsePath.apply(null, args); + resetDbpath(dbpath); + + return startMongoProgram.apply(null, args); } -// the above name could be dangerous because it deletes everything. -// so renaming to this. but keeping above for a while: -startMongodEmpty = startMongod; - +startMongod = function () { + print("WARNING DELETES DATA DIRECTORY THIS IS FOR TESTING RENAME YOUR INVOCATION"); + return startMongodEmpty.apply(null, arguments); +} startMongodNoReset = function(){ var args = createMongoArgs( "mongod" , arguments ); return startMongoProgram.apply( null, args );