diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-12-06 08:58:38 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-12-06 08:58:38 +0000 |
commit | dbbcc4144a7abef479ae9982563ed3a1cbdb725c (patch) | |
tree | dada74139078c8eaf3f33875993a73b4317b5e4d /Source/SPActivityTextFieldCell.m | |
parent | 3de284fa904c295f306ec047fc29289399424836 (diff) | |
download | sequelpro-dbbcc4144a7abef479ae9982563ed3a1cbdb725c.tar.gz sequelpro-dbbcc4144a7abef479ae9982563ed3a1cbdb725c.tar.bz2 sequelpro-dbbcc4144a7abef479ae9982563ed3a1cbdb725c.zip |
• finished implementation of SPChooseMenuItemDialog
• simplified bundle command handling and handling for bundle commands which have the same key equivalent to be able to group similar bundle commands
• minor code improvements
Diffstat (limited to 'Source/SPActivityTextFieldCell.m')
-rw-r--r-- | Source/SPActivityTextFieldCell.m | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Source/SPActivityTextFieldCell.m b/Source/SPActivityTextFieldCell.m index 5bdfa96e..f97101b4 100644 --- a/Source/SPActivityTextFieldCell.m +++ b/Source/SPActivityTextFieldCell.m @@ -239,18 +239,26 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect) // Remove highlight, and follow the link [cancelButton highlight:NO withFrame:linkRect inView:controlView]; + NSInteger status = 0; + // Cancel activity if([contextInfo objectForKey:@"type"] && [[contextInfo objectForKey:@"type"] isEqualToString:@"bashcommand"]) { NSInteger pid = [[contextInfo objectForKey:@"pid"] intValue]; if(pid > 0) { NSTask *killTask = [[NSTask alloc] init]; [killTask setLaunchPath:@"/bin/sh"]; - [killTask setArguments:[NSArray arrayWithObjects:@"-c", [NSString stringWithFormat:@"kill -9 -%ld", pid], nil]]; + // [killTask setArguments:[NSArray arrayWithObjects:@"-c", [NSString stringWithFormat:@"kill -9 -%ld", pid], nil]]; + [killTask setArguments:[NSArray arrayWithObjects:@"-c", [NSString stringWithFormat:@"[[ `ps -ax | egrep '%ld.*%@' | wc -l` -eq \"4\" ]] && kill -9 -%ld 2&> /tmp/sp_kill_error.txt", pid, SPBundleTaskScriptCommandFilePath, pid], nil]]; [killTask launch]; [killTask waitUntilExit]; + status = [killTask terminationStatus]; [killTask release]; } } + // Remove it from the list directly since the list will be updated in the background + // to avoid to cancel a command which is already cancelled + if(status == 0) + [[[controlView delegate] onMainThread] removeActivity:[[contextInfo objectForKey:@"pid"] intValue]]; return YES; } |