• 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: Invoking command line commands with environment variables set
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Invoking command line commands with environment variables set


  • Subject: Re: Invoking command line commands with environment variables set
  • From: James Quick <email@hidden>
  • Date: Tue, 5 Aug 2003 09:56:47 -0400

On Tuesday, August 5, 2003, at 04:54 AM, Terje Tjervaag wrote:

A different problem now,

I want to invoke a command line program (ly2dvi from GNU/Lilypond actually) through NSTask (or are there better ways of doing it?), but this program needs some environment variables set for it to work. These are set up when scripts from /etc/profile.d are run, and so I assume they are run every time I start a new terminal.

newtask = [[[NSTask alloc] init] retain];
NSMutableDictionary *env =[NSMutableDictionary [newTask environment];

[env setObject: @"/usr/local/share/foo" forKey: @"FOO_DIR"];
// Or addentriesFromDictionary, etc....
[newTask setDictionary: env];
[newTask setLaunchPath:...];
[newTask setArguments:...];
// or setStandardError, directory, whatever.
[newTask launch];
_______________________________________________
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.

  • Follow-Ups:
    • Re: Invoking command line commands with environment variables set
      • From: Andreas Monitzer <email@hidden>
References: 
 >Invoking command line commands with environment variables set (From: Terje Tjervaag <email@hidden>)

  • Prev by Date: Re: compiler warning
  • Next by Date: Re: Invoking command line commands with environment variables set
  • Previous by thread: Invoking command line commands with environment variables set
  • Next by thread: Re: Invoking command line commands with environment variables set
  • Index(es):
    • Date
    • Thread