0

The following code was working fine until I upgraded to OSX Lion. It called an external command and saved the output into a NSString.

I have no idea why it stopped working. Any ideas?

-(NSString *) rawResponse{
    NSTask *task = [[NSTask alloc] init];
    [task setLaunchPath:@"/usr/sbin/scselect"];

    NSPipe *pipe = [NSPipe pipe];
    [task setStandardError:pipe];
    [task launch];
    NSData *data = [[pipe fileHandleForReading] readDataToEndOfFile];
    [task waitUntilExit];
    [task release];
    NSString *result = [[[NSString alloc] initWithData:data 
                                             encoding:NSUTF8StringEncoding] autorelease];

    NSLog(@"The returned value is: %@", result);

    return result;
}
cfischer
  • 24,452
  • 37
  • 131
  • 214

1 Answers1

0

I just found out. I was assigning the NSPipe to standard error, because in Snow Leopard /usr/sbin/scselect was sending its output there, instead of standard output. Apparently the new version in Lion fixes this (and breaks my code).

cfischer
  • 24,452
  • 37
  • 131
  • 214