• 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: "-exec ..." in NSTask ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "-exec ..." in NSTask ?


  • Subject: Re: "-exec ..." in NSTask ?
  • From: Chris Ridd <email@hidden>
  • Date: Sat, 14 Jun 2003 08:30:41 +0100

On 13/6/03 3:19 pm, Mark Dalrymple <email@hidden> wrote:
> Hi Zeno,
>
>> (in reality I'll need to execute something more complex:
> < find . -name *.java -exec javac -target 1.1 -classpath
>> "/Applications/MIDP4OSX/classes":. \{} \;
>> but that DOESN'T MATTER: if I'm able to do the above, I'll be able to
> solve
>> my problem)
>
> For complex commands like that, particularly ones with high overhead
> (like find groveling through the file system), I use NSTask to start a
> shell, and feed the shell the command to run with the -c flag. It
> makes the arguments array a lot simpler and easier to maintain:

It does... until the string being fed in contains a shell-special character
at which point you've got a security hole (worst case scenario), and at best
you've got a non-functioning program.

It is much easier and safer to send the arguments as an array than to try
and add all the escaping necessary to stop sh from blowing up!

Cheers,

Chris
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: "-exec ..." in NSTask ? (From: Mark Dalrymple <email@hidden>)

  • Prev by Date: Re: NSApplication delegate not released on quit?
  • Next by Date: Re: View system usage with lower left origin
  • Previous by thread: Re: "-exec ..." in NSTask ?
  • Next by thread: RE: "-exec ..." in NSTask ?
  • Index(es):
    • Date
    • Thread