Skip navigation.
 
mlRe: redirect stderr
FROM : Jeff Schindler
DATE : Tue Nov 12 21:23:44 2002

Having a nice little conversation with myself here, but...

After digging into this a little further, it seems that you can get the
stderr NSFileHandle from the NSFileHandle class.  It seems that one should
just be able to add oneself as an observer of
NSFileHandleReadCompletionNotification and then send the stderr filehandle
off listening via readInBackgroundAndNotify, ie:

        NSFileHandle *fh = [NSFileHandle fileHandleWithStandardError];
        [[NSNotificationCenter defaultCenter] addObserver:self
            selector:@selector(getData:)
            name: NSFileHandleReadCompletionNotification
            object: fh];
        [fh readInBackgroundAndNotify];

I've tried this, but my notification proc never gets called.  Am I missing
something here?  Anyone?

Thanks,
Jeff
----- Original Message -----
From: "Jeff Schindler" <<email_removed>>
To: "Jeff Schindler" <<email_removed>>;
<<email_removed>>
Sent: Tuesday, November 05, 2002 12:35 PM
Subject: Re: redirect stderr


| Never mind - should've checked the archives first.
|
| Looks like NSTask is the answer.
|
| Jeff
| ----- Original Message -----
| From: "Jeff Schindler" <<email_removed>>
| To: <<email_removed>>
| Sent: Tuesday, November 05, 2002 10:20 AM
| Subject: redirect stderr
|
|
| | Hello,
| |
| | Is there any easy (or hard) way to redirect stderr, or more specifically
| the
| | output from NSLog?  We'd like to output it to a window in our
application.
| |
| | Thanks,
| | Jeff
| | _______________________________________________
| | cocoa-dev mailing list | <email_removed>
| | Help/Unsubscribe/Archives:
| http://www.lists.apple.com/mailman/listinfo/cocoa-dev
| | Do not post admin requests to the list. They will be ignored.
| |
|
|
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlredirect stderr Jeff Schindler Nov 5, 16:20
mlRe: redirect stderr Jeff Schindler Nov 5, 18:35
mlRe: redirect stderr Lindsey Spratt Nov 6, 01:37
mlRe: redirect stderr Jeff Schindler Nov 12, 21:23