diff options
author | stuconnolly <stuart02@gmail.com> | 2010-12-06 23:44:59 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-12-06 23:44:59 +0000 |
commit | 3fccc9c751cded1360aa22796ed3c6d700fd04c1 (patch) | |
tree | 7833f05d9540c9ad9ffd09c7dc181ee473484298 /Source/SPActivityTextFieldCell.m | |
parent | 71524d822dd449c131f6e09b2a0be0c3c0101eb1 (diff) | |
parent | 263681ef03fd33d516ca8e84db12d1c54570679f (diff) | |
download | sequelpro-3fccc9c751cded1360aa22796ed3c6d700fd04c1.tar.gz sequelpro-3fccc9c751cded1360aa22796ed3c6d700fd04c1.tar.bz2 sequelpro-3fccc9c751cded1360aa22796ed3c6d700fd04c1.zip |
Bring outlineview branch up to date with trunk (r2967:2974).
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; } |