Hello everyone
I'm writing a small app to keep track of local mono sites. I'm mostly writing this for my own use and to play around with xcode
To start the server i run the following code:
[task setLaunchPath: @"/usr/bin/xsp2"];
NSArray *arguments = [NSArray arrayWithObjects: @"--root", [[document selectedSite] valueForKey:@"path"], @"--nonstop" ,nil];
[task setArguments: arguments];
NSLog(@"argument: %@", arguments);
NSPipe *pipe = [NSPipe pipe];
[task setStandardOutput:pipe];
NSFileHandle *file = [pipe fileHandleForReading];
[task launch];
NSData *inData = nil;
while ((inData = [file availableData]) && [inData length]) {
NSLog(@"%@", [[NSString alloc] initWithData:inData encoding:NSUTF8StringEncoding]);
}
[[document selectedSite] setValue:[NSNumber numberWithInt:1] forKey:@"active"];
[task release];
NSLog(@"opened site");
This results in an infinite loop, because the terminal never stops writing (I guess?). So my question is, how do i stop the loop? Please comment if I'm being unclear.