Re: Yet another problem with NSTask and NSPipe
Re: Yet another problem with NSTask and NSPipe
- Subject: Re: Yet another problem with NSTask and NSPipe
- From: Gerd Knops <email@hidden>
- Date: Sun, 22 Apr 2007 16:41:43 -0500
On Apr 22, 2007, at 9:57 AM, Dragan Milić wrote:
Response to both Andreas and Thomas:
On ned 22. 04. 2007., at 16:07, Thomas Engelmeier wrote:
Am 22.04.2007 um 14:16 schrieb Dragan Milić:
Preample: I've used NSPipe'd NSTasks successfully on 2 GHz CoreDuo
machines w/o any problem, even for short running processes. It was
rather tricky, though, to get piping between tasks right (data got
lost until the order was waterproof). You ARE already piping (/usr/
bin/env << hdiutil), I'd eliminate this for testing
I did that, so setting '/usr/bin/hdiutil' as launch path, but the
problem remained. Anyway, I'll take this advice, and modify the
code that it doesn't use '/usr/bin/env' anymore.
The rationale behind using "/usr/bin/env" is that it will find a tool
so started by honoring the PATH environment variable. Say you have a
custom perl (or ruby or python or...) installed at /usr/local/bin,
and stock perl (ruby, python, ...) is at /usr/bin.
Without 'env' the hardcoded path will force use of whatever path is
hardcoded. With 'env', you can decide by changing the order of paths
in the 'PATH' environment variable.
Now in this case you are probably better off with the hardcoded path:
- hdiutil is a system tool, and AFAIK there are no competing
implementations
- It will encapsulate you from an ill-configured PATH environment
variables
- It may even be more secure, especially were you to run hdiutil with
elevated permissions
Now if you are running a tool to expand the capabilities of your
program by allowing user scripts etc., in that case the 'env' route
may be the way to go as it gives the power user more flexibility.
Gerd
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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