Permalink
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (38 sloc) 897 Bytes
//
// ScriptTrigger.m
// iTerm
//
// Created by George Nachman on 9/23/11.
//
#import "ScriptTrigger.h"
#import "RegexKitLite.h"
#import "NSStringITerm.h"
#include <sys/types.h>
#include <pwd.h>
@implementation ScriptTrigger
- (NSString *)title
{
return @"Run Command…";
}
- (BOOL)takesParameter
{
return YES;
}
- (NSString *)paramPlaceholder
{
return @"Enter command to run";
}
- (void)performActionWithValues:(NSArray *)values inSession:(PTYSession *)aSession
{
NSString *command = [self paramWithBackreferencesReplacedWithValues:values];
[NSThread detachNewThreadSelector:@selector(runCommand:)
toTarget:[self class]
withObject:command];
}
+ (void)runCommand:(NSString *)command
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
system([command UTF8String]);
[pool drain];
}
@end