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
|
# define _CRT_SECURE_NO_WARNINGS
|
||||||
#endif
|
#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)
|
#if defined(_WIN32)
|
||||||
# define NOMINMAX
|
# define NOMINMAX
|
||||||
# include <winsock2.h> //this must be included before the first windows.h include
|
# 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 ){
|
void errorReporter( JSContext *cx, const char *message, JSErrorReport *report ){
|
||||||
stringstream ss;
|
stringstream ss;
|
||||||
ss << "JS Error: " << message;
|
if( !isShell )
|
||||||
|
ss << "JS Error: ";
|
||||||
|
ss << message;
|
||||||
|
|
||||||
if ( report && report->filename ){
|
if ( report && report->filename ){
|
||||||
ss << " " << report->filename << ":" << report->lineno;
|
ss << " " << report->filename << ":" << report->lineno;
|
||||||
|
@ -358,7 +358,12 @@ bool fileExists( string file ){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace mongo {
|
||||||
|
extern bool isShell;
|
||||||
|
}
|
||||||
|
|
||||||
int _main(int argc, char* argv[]) {
|
int _main(int argc, char* argv[]) {
|
||||||
|
mongo::isShell = true;
|
||||||
setupSignals();
|
setupSignals();
|
||||||
|
|
||||||
mongo::shellUtils::RecordMyLocation( argv[ 0 ] );
|
mongo::shellUtils::RecordMyLocation( argv[ 0 ] );
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<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>
|
<AdditionalIncludeDirectories>\boost\</AdditionalIncludeDirectories>
|
||||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
<DisableSpecificWarnings>4355;4800;4267;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4355;4800;4267;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
|
@ -57,7 +57,7 @@ __nextPort = 27000;
|
|||||||
startMongodTest = function (port, dirname, restart) {
|
startMongodTest = function (port, dirname, restart) {
|
||||||
if (!port)
|
if (!port)
|
||||||
port = __nextPort++;
|
port = __nextPort++;
|
||||||
var f = startMongod;
|
var f = startMongodEmpty;
|
||||||
if (restart)
|
if (restart)
|
||||||
f = startMongodNoReset;
|
f = startMongodNoReset;
|
||||||
if (!dirname)
|
if (!dirname)
|
||||||
@ -79,20 +79,19 @@ startMongodTest = function (port, dirname, restart) {
|
|||||||
|
|
||||||
// Start a mongod instance and return a 'Mongo' object connected to it.
|
// Start a mongod instance and return a 'Mongo' object connected to it.
|
||||||
// This function's arguments are passed as command line arguments to mongod.
|
// This function's arguments are passed as command line arguments to mongod.
|
||||||
// The specified 'dbpath' is cleared if it exists, created if not.
|
// The specified 'dbpath' is cleared if it exists, created if not.
|
||||||
startMongod = function(){
|
startMongodEmpty = function () {
|
||||||
// WARNING DELETES DATA DIRECTORY ON STARTUP THIS IS FOR TESTING
|
var args = createMongoArgs("mongod", arguments);
|
||||||
var args = createMongoArgs( "mongod" , arguments );
|
|
||||||
|
var dbpath = _parsePath.apply(null, args);
|
||||||
var dbpath = _parsePath.apply( null, args );
|
resetDbpath(dbpath);
|
||||||
resetDbpath( dbpath );
|
|
||||||
|
return startMongoProgram.apply(null, args);
|
||||||
return startMongoProgram.apply( null, args );
|
|
||||||
}
|
}
|
||||||
// the above name could be dangerous because it deletes everything.
|
startMongod = function () {
|
||||||
// so renaming to this. but keeping above for a while:
|
print("WARNING DELETES DATA DIRECTORY THIS IS FOR TESTING RENAME YOUR INVOCATION");
|
||||||
startMongodEmpty = startMongod;
|
return startMongodEmpty.apply(null, arguments);
|
||||||
|
}
|
||||||
startMongodNoReset = function(){
|
startMongodNoReset = function(){
|
||||||
var args = createMongoArgs( "mongod" , arguments );
|
var args = createMongoArgs( "mongod" , arguments );
|
||||||
return startMongoProgram.apply( null, args );
|
return startMongoProgram.apply( null, args );
|
||||||
|
Loading…
Reference in New Issue
Block a user