mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 01:21:03 +01:00
shell cleaning
This commit is contained in:
parent
001b28d3f6
commit
4c51a62b5b
6
pch.h
6
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 <winsock2.h> //this must be included before the first windows.h include
|
||||
|
@ -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;
|
||||
|
@ -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 ] );
|
||||
|
@ -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>
|
||||
|
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user