Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make shell killOp on ctrl-c stuff work on windows too SERVER-1451

  • Loading branch information...
commit b7817b8986c958e426a5740810e0347f6a25aa2b 1 parent 1f36424
@RedBeard0531 RedBeard0531 authored
Showing with 8 additions and 15 deletions.
  1. +1 −5 jstests/shellkillop.js
  2. +7 −10 shell/dbshell.cpp
View
6 jstests/shellkillop.js
@@ -5,11 +5,7 @@ retry = false;
function testShellAutokillop() {
-if (_isWindows()) {
- print("shellkillop.js not testing on windows, as functionality is missing there");
- print("shellkillop.js see http://jira.mongodb.org/browse/SERVER-1451");
-}
-else {
+if (true) { // toggle to disable test
db[baseName].drop();
print("shellkillop.js insert data");
View
17 shell/dbshell.cpp
@@ -135,7 +135,6 @@ void intr( int sig ) {
#endif
}
-#if !defined(_WIN32)
void killOps() {
if ( mongo::shellUtils::_nokillop || mongo::shellUtils::_allMyUris.size() == 0 )
return;
@@ -180,20 +179,16 @@ void quitNicely( int sig ) {
gotInterrupted = 1;
return;
}
+
+#if !defined(_WIN32)
if ( sig == SIGPIPE )
mongo::rawOut( "mongo got signal SIGPIPE\n" );
+#endif
+
killOps();
shellHistoryDone();
exit(0);
}
-#else
-void quitNicely( int sig ) {
- mongo::dbexitCalled = true;
- //killOps();
- shellHistoryDone();
- exit(0);
-}
-#endif
char * shellReadline( const char * prompt , int handlesigint = 0 ) {
@@ -267,7 +262,9 @@ void setupSignals() {
set_terminate( myterminate );
}
#else
-inline void setupSignals() {}
+inline void setupSignals() {
+ signal( SIGINT , quitNicely ); // surprisingly this works on windows too
+}
#endif
string fixHost( string url , string host , string port ) {
Please sign in to comment.
Something went wrong with that request. Please try again.