Re: NSTask and environment variables
Re: NSTask and environment variables
- Subject: Re: NSTask and environment variables
- From: Ken Thomases <email@hidden>
- Date: Wed, 10 Dec 2008 03:09:14 -0600
On Dec 9, 2008, at 4:51 AM, Ingvar Nedrebo wrote:
On Dec 9, 2008, at 00:43, Chris Idou wrote:
I want to call a script with NSTask and I want to set an environment
variable.
But it seems like bad form to blow away the current environment. So
I guess I
need to read the current environment and extend it before passing
it to
NSTask.
Is there any Cocoa API which returns the environment as a
NSDictionary, or do
I need to drop down to the UNIX getenv() level?
I just call setenv(). That sets one variable without affecting the
rest of the environment, as far as I know?
Yes, but it affects the current process, which may be undesirable.
One often wants to set the environment variable only for the child
process, which is what I assume the OP is after.
Regards,
Ken
_______________________________________________
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