Permalink
Browse files

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

  • Loading branch information...
1 parent 1f36424 commit b7817b8986c958e426a5740810e0347f6a25aa2b @RedBeard0531 RedBeard0531 committed Apr 6, 2011
Showing with 8 additions and 15 deletions.
  1. +1 −5 jstests/shellkillop.js
  2. +7 −10 shell/dbshell.cpp
View
@@ -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
@@ -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 ) {

0 comments on commit b7817b8

Please sign in to comment.