get return value from NSUserUnixTask
get return value from NSUserUnixTask
- Subject: get return value from NSUserUnixTask
- From: Rainer Standke <email@hidden>
- Date: Sat, 13 Apr 2013 15:41:56 -0700
Hello all,
I have a sandboxed Mac app that I want to write user script for (which could run outside of the sandbox). I am trying to write that script as a stand-lone Unix executable. I have that called as a NSUserUnixTask, and I can see that it runs. However my sandboxed app doesn't get a return value.
This is what I do:
NSUserUnixTask *task = [[NSUserUnixTask alloc] initWithURL:userScriptURL error:nil];
NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
fileHandle.readabilityHandler = ^(NSFileHandle *fh){
NSLog(@"readable");
NSData *resultData = [fh availableData];
NSLog(@"resultData: %@", resultData);
};
task.standardOutput = fileHandle;
[task executeWithArguments:affectedFolderPaths completionHandler:^(NSError *error) {
NSLog(@"compl error: %@", error);
}];
The error is null, the script/task runs, but the readability handler never gets called.
My question is how am I supposed to do get the result from the task?
Thanks,
Rainer
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden