Re: NSTask setStandardOutput: then stringWithContentsOfFile gives empty string
Re: NSTask setStandardOutput: then stringWithContentsOfFile gives empty string
- Subject: Re: NSTask setStandardOutput: then stringWithContentsOfFile gives empty string
- From: Chris Suter <email@hidden>
- Date: Tue, 28 Aug 2007 08:42:10 +1000
A good example of a tool whose output you *should* be parsing
rather than trying to emulate its (horrific) workings is "lsof".
Parsing the output of lsof is a whole lot more likely to continue
working in the future than trying to do what it does.
lsof is not a good example. If I needed to do what lsof did, I'd
take it from the source code of lsof (http://
www.opensource.apple.com/darwinsource/10.4.9.ppc/lsof-28/lsof/) and
adapt it to my specific needs. lsof has a lot of options that may
not be necessary to implement for your needs.
It doesn't sound like you've looked at the source code for lsof. lsof
definitely is a good example of where you should be parsing its
output rather than implementing it yourself although it's less
important if you only want it to work on one particular version of OS X.
Part of the problem with lsof is that it depends upon internal kernel
memory structures which change depending upon kernel version. The
10.4.9 version of lsof will not work on 10.3 for example. By parsing
the output of lsof (which does have specific options to help in this
regard) you will be able to have something that works on future
versions of OS X.
- Chris
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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