summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/msvc/mongo.vcxproj3
-rw-r--r--shell/msvc/mongo.vcxproj.filters5
-rw-r--r--shell/servers.js72
-rw-r--r--shell/shell_utils.cpp9
-rw-r--r--shell/utils.js71
5 files changed, 83 insertions, 77 deletions
diff --git a/shell/msvc/mongo.vcxproj b/shell/msvc/mongo.vcxproj
index a59e87efac5..cf258c072af 100644
--- a/shell/msvc/mongo.vcxproj
+++ b/shell/msvc/mongo.vcxproj
@@ -238,6 +238,9 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</Library>
</ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\db\lasterror.h" />
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/shell/msvc/mongo.vcxproj.filters b/shell/msvc/mongo.vcxproj.filters
index 8eb6e34fe43..df87998b04a 100644
--- a/shell/msvc/mongo.vcxproj.filters
+++ b/shell/msvc/mongo.vcxproj.filters
@@ -248,4 +248,9 @@
<Library Include="..\..\..\js\js32d.lib" />
<Library Include="..\..\..\js\js32r.lib" />
</ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\db\lasterror.h">
+ <Filter>db</Filter>
+ </ClInclude>
+ </ItemGroup>
</Project> \ No newline at end of file
diff --git a/shell/servers.js b/shell/servers.js
index 3015005d5bf..b0659cf02b9 100644
--- a/shell/servers.js
+++ b/shell/servers.js
@@ -51,46 +51,46 @@ createMongoArgs = function( binaryName , args ){
}
return fullArgs;
-}
-
-__nextPort = 27000;
-startMongodTest = function (port, dirname, restart) {
- if (!port)
- port = __nextPort++;
- var f = startMongodEmpty;
- if (restart)
- f = startMongodNoReset;
- if (!dirname)
- dirname = "" + port; // e.g., data/db/27000
- var conn = f.apply(null, [
- {
- port: port,
- dbpath: "/data/db/" + dirname,
- noprealloc: "",
- smallfiles: "",
- oplogSize: "2",
- nohttpinterface: ""
- }
- ]
- );
- conn.name = "localhost:" + port;
- return conn;
+}
+
+__nextPort = 27000;
+startMongodTest = function (port, dirname, restart) {
+ if (!port)
+ port = __nextPort++;
+ var f = startMongodEmpty;
+ if (restart)
+ f = startMongodNoReset;
+ if (!dirname)
+ dirname = "" + port; // e.g., data/db/27000
+ var conn = f.apply(null, [
+ {
+ port: port,
+ dbpath: "/data/db/" + dirname,
+ noprealloc: "",
+ smallfiles: "",
+ oplogSize: "2",
+ nohttpinterface: ""
+ }
+ ]
+ );
+ conn.name = "localhost:" + port;
+ return conn;
}
// 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.
-startMongodEmpty = function () {
- var args = createMongoArgs("mongod", arguments);
-
- var dbpath = _parsePath.apply(null, args);
- resetDbpath(dbpath);
-
- return startMongoProgram.apply(null, args);
-}
-startMongod = function () {
- print("WARNING DELETES DATA DIRECTORY THIS IS FOR TESTING RENAME YOUR INVOCATION");
- return startMongodEmpty.apply(null, arguments);
+// 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);
+}
+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 );
diff --git a/shell/shell_utils.cpp b/shell/shell_utils.cpp
index 4e9a43928e2..9b20608856f 100644
--- a/shell/shell_utils.cpp
+++ b/shell/shell_utils.cpp
@@ -389,7 +389,7 @@ namespace mongo {
ZeroMemory(&pi, sizeof(pi));
bool success = CreateProcess( NULL, args_tchar.get(), NULL, NULL, true, 0, NULL, NULL, &si, &pi) != 0;
- assert(success);
+ uassert(13294, "couldn't start process", success);
CloseHandle(pi.hThread);
@@ -463,8 +463,6 @@ namespace mongo {
return x;
}
-
-
BSONObj StartMongoProgram( const BSONObj &a ) {
_nokillop = true;
ProgramRunner r( a );
@@ -561,8 +559,7 @@ namespace mongo {
}
#endif
- }
-
+ }
int killDb( int port, pid_t _pid, int signal ) {
pid_t pid;
@@ -708,6 +705,7 @@ namespace mongo {
//can't launch programs
scope.injectNative( "_startMongoProgram", StartMongoProgram );
scope.injectNative( "runProgram", RunProgram );
+ scope.injectNative( "run", RunProgram );
scope.injectNative( "runMongoProgram", RunMongoProgram );
scope.injectNative( "stopMongod", StopMongoProgram );
scope.injectNative( "stopMongoProgram", StopMongoProgram );
@@ -716,7 +714,6 @@ namespace mongo {
scope.injectNative( "clearRawMongoProgramOutput", ClearRawMongoProgramOutput );
scope.injectNative( "waitProgram" , WaitProgram );
- //can't access filesystem
scope.injectNative( "removeFile" , removeFile );
scope.injectNative( "listFiles" , listFiles );
scope.injectNative( "ls" , ls );
diff --git a/shell/utils.js b/shell/utils.js
index d8f84120232..743b892f541 100644
--- a/shell/utils.js
+++ b/shell/utils.js
@@ -803,41 +803,42 @@ shellHelper = function( command , rest , shouldPrint ){
shellPrintHelper( res );
}
return res;
-}
-
-help = shellHelper.help = function (x) {
- if (x == "admin") {
- print("\tls([path]) list files");
- print("\tpwd() returns current directory");
- print("\tlistFiles([path]) returns file list");
- print("\thostname() returns name of this host");
- print("\tremoveFile(f) delete a file");
- print("\tload(jsfilename) load and execute a .js file");
- print("\tsleep(m) sleep m milliseconds");
- return;
- }
- if (x == "test") {
- print("\tstartMongodEmpty(args) DELETES DATA DIR and then starts mongod");
- print("\t returns a connection to the new server");
- print("\tstartMongodTest() DELETES DATA DIR");
- print("\t automatically picks port #s starting at 27000 and increasing");
- print("\t or you can specify the port as the first arg");
- print("\t dir is /data/db/<port>/ if not specified as the 2nd arg");
- print("\t returns a connection to the new server");
- return;
- }
- print("\t" + "help admin misc shell commands");
- print("\t" + "show dbs show database names");
- print("\t" + "show collections show collections in current database");
- print("\t" + "show users show users in current database");
- print("\t" + "show profile show most recent system.profile entries with time >= 1ms");
- print("\t" + "use <db name> set curent database to <db name>");
- print("\t" + "db.help() help on DB methods");
- print("\t" + "db.foo.help() help on collection methods");
- print("\t" + "db.foo.find() list objects in collection foo");
- print("\t" + "db.foo.find( { a : 1 } ) list objects in foo where a == 1");
- print("\t" + "it result of the last line evaluated; use to further iterate");
- print("\t" + "exit quit the mongo shell");
+}
+
+help = shellHelper.help = function (x) {
+ if (x == "admin") {
+ print("\tls([path]) list files");
+ print("\tpwd() returns current directory");
+ print("\tlistFiles([path]) returns file list");
+ print("\thostname() returns name of this host");
+ print("\tremoveFile(f) delete a file");
+ print("\tload(jsfilename) load and execute a .js file");
+ print("\trun(program[, args...]) spawn a program and wait for its completion");
+ print("\tsleep(m) sleep m milliseconds");
+ return;
+ }
+ if (x == "test") {
+ print("\tstartMongodEmpty(args) DELETES DATA DIR and then starts mongod");
+ print("\t returns a connection to the new server");
+ print("\tstartMongodTest() DELETES DATA DIR");
+ print("\t automatically picks port #s starting at 27000 and increasing");
+ print("\t or you can specify the port as the first arg");
+ print("\t dir is /data/db/<port>/ if not specified as the 2nd arg");
+ print("\t returns a connection to the new server");
+ return;
+ }
+ print("\t" + "help admin misc shell commands");
+ print("\t" + "show dbs show database names");
+ print("\t" + "show collections show collections in current database");
+ print("\t" + "show users show users in current database");
+ print("\t" + "show profile show most recent system.profile entries with time >= 1ms");
+ print("\t" + "use <db name> set curent database to <db name>");
+ print("\t" + "db.help() help on DB methods");
+ print("\t" + "db.foo.help() help on collection methods");
+ print("\t" + "db.foo.find() list objects in collection foo");
+ print("\t" + "db.foo.find( { a : 1 } ) list objects in foo where a == 1");
+ print("\t" + "it result of the last line evaluated; use to further iterate");
+ print("\t" + "exit quit the mongo shell");
}
shellHelper.use = function( dbname ){