From c1cb48f6afa93b8ed26baa434d66d1ca3e0afca7 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Mon, 29 Nov 2010 21:25:52 +0000 Subject: =?UTF-8?q?=E2=80=A2=20Bundle=20commands=20-=20register=20running?= =?UTF-8?q?=20commands=20for=20each=20SPDatabaseDocument=20or=20if=20the?= =?UTF-8?q?=20command=20runs=20via=20'General'=20for=20NSApp=20delegate=20?= =?UTF-8?q?-=20kill=20all=20running=20commands=20before=20SP=20will=20be?= =?UTF-8?q?=20terminated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPDatabaseDocument.m | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'Source/SPDatabaseDocument.m') diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 4b52b39d..23805b12 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -116,6 +116,7 @@ spfSession = nil; spfPreferences = [[NSMutableDictionary alloc] init]; spfDocData = [[NSMutableDictionary alloc] init]; + runningBASHprocesses = [[NSMutableArray alloc] init]; titleAccessoryView = nil; taskProgressWindow = nil; @@ -2400,6 +2401,7 @@ */ - (void)applicationWillTerminate:(NSNotification *)notification { + // Auto-save preferences to spf file based connection if([self fileURL] && [[[self fileURL] path] length] && ![self isUntitled]) if(_isConnected && ![self saveDocumentWithFilePath:nil inBackground:YES onlyPreferences:YES contextInfo:nil]) { @@ -2408,7 +2410,7 @@ } [tablesListInstance selectionShouldChangeInTableView:nil]; - + // 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]; @@ -4738,6 +4740,26 @@ NSLog(@"received: %@", commandDict); } +- (void)registerBASHCommand:(NSDictionary*)commandDict +{ + [runningBASHprocesses addObject:commandDict]; +} + +- (void)unRegisterBASHCommand:(NSInteger)pid +{ + for(id cmd in runningBASHprocesses) { + if([[cmd objectForKey:@"pid"] integerValue] == pid) { + [runningBASHprocesses removeObject:cmd]; + break; + } + } +} + +- (NSArray*)runningBASHProcesses +{ + return (NSArray*)runningBASHprocesses; +} + - (NSDictionary*)shellVariables { NSMutableDictionary *env = [NSMutableDictionary dictionary]; @@ -4989,6 +5011,7 @@ */ - (void)dealloc { + // Unregister observers [prefs removeObserver:self forKeyPath:SPDisplayTableViewVerticalGridlines]; [prefs removeObserver:tableSourceInstance forKeyPath:SPDisplayTableViewVerticalGridlines]; @@ -5037,6 +5060,7 @@ if (taskProgressWindow) [taskProgressWindow release]; if (serverSupport) [serverSupport release]; if (processID) [processID release]; + if (runningBASHprocesses) [runningBASHprocesses release]; [super dealloc]; } -- cgit v1.2.3