Use dot notation in NTSynchronousTask.

Change the getter for the done ivar to isDone.
This commit is contained in:
C.W. Betts committed 2014-02-09 14:46:26 -07:00
1 parent fde6b4775e
commit 808bde2699
1 file changed
+19 -19
+19 -19
View File
@@ -18,7 +18,7 @@
@property (retain) NSPipe *outputPipe;
@property (retain) NSPipe *inputPipe;
@property (readwrite, retain) NSData *output;
@property BOOL done;
@property (getter = isDone) BOOL done;
@property (readwrite) int result;
@end
@@ -32,14 +32,14 @@
- (void)taskOutputAvailable:(NSNotification*)note
{
[self setOutput:[[note userInfo] objectForKey:NSFileHandleNotificationDataItem]];
self.output = [[note userInfo] objectForKey:NSFileHandleNotificationDataItem];
[self setDone:YES];
self.done = YES;
}
- (void)taskDidTerminate:(NSNotification*)note
{
[self setResult:[[self task] terminationStatus]];
self.result = [self.task terminationStatus];
}
- (id)init;
@@ -47,13 +47,13 @@
self = [super init];
if (self)
{
[self setTask:[[[NSTask alloc] init] autorelease]];
[self setOutputPipe:[[[NSPipe alloc] init] autorelease]];
[self setInputPipe:[[[NSPipe alloc] init] autorelease]];
self.task = [[[NSTask alloc] init] autorelease];
self.outputPipe = [[[NSPipe alloc] init] autorelease];
self.inputPipe = [[[NSPipe alloc] init] autorelease];
[[self task] setStandardInput:[self inputPipe]];
[[self task] setStandardOutput:[self outputPipe]];
[[self task] setStandardError:[self outputPipe]];
self.task.standardInput = self.inputPipe;
self.task.standardOutput = self.outputPipe;
self.task.standardError = self.outputPipe;
}
return self;
@@ -79,10 +79,10 @@
BOOL success = NO;
if (currentDirectory)
[[self task] setCurrentDirectoryPath: currentDirectory];
self.task.currentDirectoryPath = currentDirectory;
[[self task] setLaunchPath:toolPath];
[[self task] setArguments:args];
self.task.launchPath = toolPath;
self.task.arguments = args;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(taskOutputAvailable:)
@@ -98,7 +98,7 @@
@try
{
[[self task] launch];
[self.task launch];
success = YES;
}
@catch (NSException *localException) { }
@@ -108,12 +108,12 @@
if (input)
{
// feed the running task our input
[[[self inputPipe] fileHandleForWriting] writeData:input];
[[[self inputPipe] fileHandleForWriting] closeFile];
[[self.inputPipe fileHandleForWriting] writeData:input];
[[self.inputPipe fileHandleForWriting] closeFile];
}
// loop until we are done receiving the data
if (![self done])
if (!self.done)
{
double resolution = 1;
BOOL isRunning;
@@ -124,7 +124,7 @@
isRunning = [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
beforeDate:next];
} while (isRunning && ![self done]);
} while (isRunning && !self.done);
}
}
}
@@ -133,7 +133,7 @@
{
// we need this wacky pool here, otherwise we run out of pipes, the pipes are internally autoreleased
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSData* result=nil;
NSData* result = nil;
@try
{