• 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
I can capture stderr but can't capture stdout... unless debugging?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

I can capture stderr but can't capture stdout... unless debugging?


  • Subject: I can capture stderr but can't capture stdout... unless debugging?
  • From: "John C. Daub" <email@hidden>
  • Date: Sat, 25 Sep 2004 11:36:39 -0500

Hello.

I'm working with some logging code (thanx, Shaun). The logging code works to
capture stderr along lines similar to this:

<http://www.cocoabuilder.com/archive/message/2003/12/18/92550>
<http://lists.apple.com/archives/cocoa-dev/2003/Dec/msg00894.html>

In the approaches outlined in those messages, this code takes the route of
using NSPipe and NSFileHandle's (tho it doesn't do step 1, and when I tried
that the app complained of a bad file descriptor and crashed). It works
perfectly for stderr, however, I wish to capture stdout. So I've gone
through the code and replaced stderr with stdout and STDERR_FILENO with
STDOUT_FILENO.

Unfortunately, the code doesn't work... at least, it doesn't work if I run
outside of the debugger. If I run under the debugger, then it's capturing
stdout just fine and I see all the fprintf(stdout, ...) output in my window
and log file just as desired. However, if I run without the debugger then
the code doesn't work; it's sitting there blocked in the call to [[myPipe
fileHandleForReading] availableData];  It just sits and spins, doesn't
unblock, never returning.

What's really got me confused is why it's working in the debugger and not
outside of the debugger.

Looking for ideas and information, if not an outright solution.

Thanx for any help you can provide.

--
John C. Daub }:-)>=
<mailto:email@hidden> <http://www.hsoi.com/>
"Perfection is achieved, not when there is nothing more to add, but
when there is nothing left to take away." - Antoine de Saint-Exupery


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: I can capture stderr but can't capture stdout... unless debugging?
      • From: Allan Odgaard <email@hidden>
  • Prev by Date: Re: Unit testing framework suggestions?
  • Next by Date: [Newbie] Multiple NSTableViews
  • Previous by thread: Dragging an NSImage from an NSTextView?
  • Next by thread: Re: I can capture stderr but can't capture stdout... unless debugging?
  • Index(es):
    • Date
    • Thread