• 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
Re: NSTask setStandardOutput: then stringWithContentsOfFile gives empty string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask setStandardOutput: then stringWithContentsOfFile gives empty string


  • Subject: Re: NSTask setStandardOutput: then stringWithContentsOfFile gives empty string
  • From: Oleg Kibirev <email@hidden>
  • Date: Mon, 27 Aug 2007 14:42:33 -0700

This is one personal opinion, however UNIX philosophy is very much about constructing pipelines and reusing existing command line tools instead of reinventing the wheel:

http://www.linuxlots.com/~dunne/unix-philosophy.html

In addition, output of ps is in fact standardized, especially now that MacOSX is going to be officially certified as UNIX. NSTask parsing output of ps is more likely to run unmodified on GNUStep/ Linux then the code reading /dev/kmem directly.

Having said that, -[NSWorkspace launchedApplications] may be more appropriate if only a list of running GUI applications is needed.

Oleg


On Aug 27, 2007, at 2:24 PM, Rosyna wrote:

In fact, parsing tool output is very, very bad and should never be done.

See this reply by Jordan Hubbard on darwin-dev. http:// lists.apple.com/archives/darwin-dev/2007/Aug/msg00107.html

So don't use NSTask to create any files to parse from command line tools. And don't use NSTask to directly parse the output of the tools. The output has changed in the past and they will change in the future.

Use the APIs instead.

Ack, at 8/27/07, Rosyna said:

Or he could just not use NSTask...

--


Sincerely, Rosyna Keller Technical Support/Carbon troll/Always needs a hug

Unsanity: Unsane Tools for Insanely Great People

It's either this, or imagining Phil Schiller in a thong.
_______________________________________________

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:
40oracle.com


This email sent to email@hidden

_______________________________________________

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


  • Follow-Ups:
    • Re: NSTask setStandardOutput: then stringWithContentsOfFile gives empty string
      • From: Rosyna <email@hidden>
References: 
 >NSTask setStandardOutput: then stringWithContentsOfFile gives empty string (From: Gonzalo Castro <email@hidden>)
 >Re: NSTask setStandardOutput: then stringWithContentsOfFile gives empty string (From: "Shawn Erickson" <email@hidden>)
 >Re: NSTask setStandardOutput: then stringWithContentsOfFile gives empty string (From: Rosyna <email@hidden>)
 >Re: NSTask setStandardOutput: then stringWithContentsOfFile gives empty string (From: Rosyna <email@hidden>)

  • Prev by Date: Capturing Command-Tab and Command-Alt-Esc
  • Next by Date: Re: Capturing Command-Tab and Command-Alt-Esc
  • Previous by thread: Re: NSTask setStandardOutput: then stringWithContentsOfFile gives empty string
  • Next by thread: Re: NSTask setStandardOutput: then stringWithContentsOfFile gives empty string
  • Index(es):
    • Date
    • Thread