Andy, THANK YOU SO MUCH!!
I am glad my inquiry spawned some interest but you have taught me how to fish ;^) Thanks again On Aug 13, 2012, at 7:27 PM, Andy Lee wrote: > Apple seems to have pulled the ancient "Moriarity" example which demonstrates > basic use of NSTask, but my cleanup of it should still work. > > <https://github.com/aglee/MoreArty> > > --Andy > > On Aug 13, 2012, at 6:42 PM, Kyle Sluder <k...@ksluder.com> wrote: > >> On Mon, Aug 13, 2012, at 02:17 PM, Charlie Dickman wrote: >>> I'm trying to get the output from a vm_stat command using the following >>> code. My app hangs in the [vmRead availableData] call as it should if >>> there is no data available but it never comes back. What am I doing >>> wrong? I have searched through the sample code on apples developer site >>> with no luck. >>> >>> NSPipe *vmPipe = [NSPipe pipe]; >>> NSFileHandle *vmRead = [vmPipe fileHandleForReading]; >>> >>> [vm setLaunchPath: @"/usr/bin/vm_stat"]; // 1 page = 4096 >>> bytes >>> [vm setStandardOutput: vmPipe]; >>> [vm launch]; >>> NSData *vmData = nil; >>> int vmDataLength = 0; >>> do { >>> vmData = [vmRead availableData]; >>> vmDataLength = [vmData length]; >>> } while (vmDataLength != 0); >> >> >> You can't do this. You need to run the runloop. >> >> --Kyle Sluder >> _______________________________________________ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> 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: >> https://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com >> >> This email sent to ag...@mac.com > Charlie Dickman 3tothe...@comcast.net _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com