• 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
Fwd: stdout redirect in xcode and not
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: stdout redirect in xcode and not


  • Subject: Fwd: stdout redirect in xcode and not
  • From: email@hidden
  • Date: Wed, 24 Dec 2008 08:52:32 -0500


On Dec 24, 2008, at 1:42 AM, Wesley Smith wrote:

In the end, I had to use a polling method as I couldn't find any way
to get callbacks when a pipe has data to read off the read endpoint.


I've done something similar where I created a pipe and exec'ed a subtask. Did you try this:


NSFileHandle *readPipeHandle = [NSFileHandle alloc] initWithFileDescriptor:pipe[0]];
[readPipeHandle setDelegate: self];
[readPipeHandle waitForDataInBackgroundAndNotify];


[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(logDataAvailableCallback:) name: NSFileHandleDataAvailableNotification object:readPipeHandle];

.
.
.

- (void) logDataAvailableCallback:(NSNotification *)notif
{
	NSFileHandle *handle = [notif object];
	NSData *data = [handle availableData];
	...
	[handle waitForDataInBackgroundAndNotify];
}


Even better, for getting the pipe handle:

NSPipe *pipe = [NSPipe pipe];
NSFileHandle *readPipeHandle = [pipe fileHandleForReading];

Aaron


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: stdout redirect in xcode and not
  • Next by Date: re: How do I link with copied libs?
  • Previous by thread: Re: stdout redirect in xcode and not
  • Next by thread: Adding frameworks question...
  • Index(es):
    • Date
    • Thread