• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
get return value from NSUserUnixTask
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: get return value from NSUserUnixTask
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: multiple profiles in preferences mechanism
  • Next by Date: Re: get return value from NSUserUnixTask
  • Previous by thread: Can Deactivation be Prevented When Launching Popover?
  • Next by thread: Re: get return value from NSUserUnixTask
  • Index(es):
    • Date
    • Thread