aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPStringAdditions.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-12-01 12:23:22 +0000
committerBibiko <bibiko@eva.mpg.de>2010-12-01 12:23:22 +0000
commit019a1015546ab203eb366a71811d6c75b130fd40 (patch)
tree6d93981dd3340eeb6586ae35a1a4720c48f854f5 /Source/SPStringAdditions.m
parent8e9f5d343c0128c06a018fb58751ac67ec1dfa6f (diff)
downloadsequelpro-019a1015546ab203eb366a71811d6c75b130fd40.tar.gz
sequelpro-019a1015546ab203eb366a71811d6c75b130fd40.tar.bz2
sequelpro-019a1015546ab203eb366a71811d6c75b130fd40.zip
• added chance to cancel an activity - up to now a running Bundle command - from the Activities pane (toggable via double-clicking at Table Information header); it's still tentative and the correct cancel icon will follow asap
• added notification system for updating the activities pane (SPActivitiesUpdateNotification)
Diffstat (limited to 'Source/SPStringAdditions.m')
-rw-r--r--Source/SPStringAdditions.m21
1 files changed, 10 insertions, 11 deletions
diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m
index 658baadb..27b8fcd0 100644
--- a/Source/SPStringAdditions.m
+++ b/Source/SPStringAdditions.m
@@ -451,7 +451,7 @@
* @param theError If not nil and the bash command failed it contains the returned error message as NSLocalizedDescriptionKey
*
*/
-- (NSString *)runBashCommandWithEnvironment:(NSDictionary*)shellEnvironment atCurrentDirectoryPath:(NSString*)path callerDocument:(id)caller withName:(NSString*)name error:(NSError**)theError
+- (NSString *)runBashCommandWithEnvironment:(NSDictionary*)shellEnvironment atCurrentDirectoryPath:(NSString*)path callerInstance:(id)caller contextInfo:(NSDictionary*)contextInfo error:(NSError**)theError
{
BOOL userTerminated = NO;
@@ -549,14 +549,16 @@
NSFileHandle *stderr_file = [stderr_pipe fileHandleForReading];
[bashTask launch];
NSInteger pid = -1;
- if(caller != nil && [caller respondsToSelector:@selector(registerBASHCommand:)]) {
+ if(caller != nil && [caller respondsToSelector:@selector(registerActivity:)]) {
// register command
pid = [bashTask processIdentifier];
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:pid], @"pid",
- name, @"name",
+ (contextInfo)?:[NSDictionary dictionary], @"contextInfo",
+ @"bashcommand", @"type",
[[NSDate date] descriptionWithCalendarFormat:@"%H:%M:%S" timeZone:nil locale:[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]], @"starttime",
nil];
- [caller registerBASHCommand:dict];
+ [caller registerActivity:dict];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPActivitiesUpdateNotification object:nil];
}
// Listen to ⌘. to terminate
@@ -584,15 +586,12 @@
[bashTask waitUntilExit];
// unregister BASH command if it was registered
- if(pid >= 0) [caller unRegisterBASHCommand:pid];
-
- if(userTerminated) {
- if(bashTask) [bashTask release];
- NSBeep();
- NSLog(@"“%@” was terminated by user.", ([self length] > 50) ? [self substringToIndex:50] : self);
- return @"";
+ if(pid >= 0) {
+ [caller removeRegisteredActivity:pid];
+ [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPActivitiesUpdateNotification object:nil];
}
+ // Remove script file if used
if(redirectForScript)
[[NSFileManager defaultManager] removeItemAtPath:scriptFilePath error:nil];