diff options
Diffstat (limited to 'Source/SPDatabaseDocument.m')
-rw-r--r-- | Source/SPDatabaseDocument.m | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 23805b12..8ec6ad61 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -3655,6 +3655,7 @@ */ - (BOOL)parentTabShouldClose { + // If no connection is available, always return YES. Covers initial setup and disconnections. if(!_isConnected) return YES; @@ -3673,8 +3674,23 @@ return isSaved; } + // Terminate all running BASH commands + for(NSDictionary* cmd in [self runningBASHProcesses]) { + NSInteger pid = [[cmd objectForKey:@"pid"] intValue]; + NSTask *killTask = [[NSTask alloc] init]; + [killTask setLaunchPath:@"/bin/sh"]; + [killTask setArguments:[NSArray arrayWithObjects:@"-c", [NSString stringWithFormat:@"kill -9 -%ld", pid], nil]]; + [killTask launch]; + [killTask waitUntilExit]; + [killTask release]; + } + [[SPNavigatorController sharedNavigatorController] performSelectorOnMainThread:@selector(removeConnection:) withObject:[self connectionID] waitUntilDone:YES]; + // Note that this call does not need to be removed in release builds as leaks analysis output is only + // dumped if [[SPLogger logger] setDumpLeaksOnTermination]; has been called first. + [[SPLogger logger] dumpLeaks]; + // Return YES by default return YES; } @@ -3703,6 +3719,7 @@ [createTableSyntaxWindow orderOut:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self]; [self setParentWindow:nil]; + } /** |