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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to