0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00

shell cleaning

This commit is contained in:
dwight 2010-06-07 21:50:36 -04:00
parent 001b28d3f6
commit 4c51a62b5b
5 changed files with 31 additions and 16 deletions

6
pch.h
View File

@ -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 <winsock2.h> //this must be included before the first windows.h include

View File

@ -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;

View File

@ -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 ] );

View File

@ -53,7 +53,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>XP_WIN;_WIN32;PCRE_STATIC;HAVE_CONFIG_H;OLDJS;MONGO_EXPOSE_MACROS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>XP_WIN;PCRE_STATIC;HAVE_CONFIG_H;OLDJS;MONGO_EXPOSE_MACROS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>\boost\</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<DisableSpecificWarnings>4355;4800;4267;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>

View File

@ -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 );