• 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, environment and ... X11
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask, environment and ... X11


  • Subject: Re: NSTask, environment and ... X11
  • From: Andrew Farmer <email@hidden>
  • Date: Tue, 31 Jan 2006 18:31:17 -0800

On 31 Jan 06, at 16:24, Thierry Passeron wrote:
Hello there
I was wondering why this piece of code doesn't work by itself on my mac ?


NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath: @"/bin/bash"];

NSDictionary * environment = [NSDictionary dictionaryWithObjectsAndKeys:@"localhost:0.0",@"DISPLAY",nil];
NSArray * arguments = [NSArray arrayWithObjects: @"-c", @"/usr/ X11R6/bin/xhost + && /sw/bin/nedit", nil];
[task setEnvironment: environment];
[task setArguments: arguments];
[task launch];

Running "xhost +" makes the baby Jesus cry - and opens up a potential major security hole. Don't use it.


Also, you can't assume that the correct DISPLAY is :0.0 - what if more than one user has X11 open? (Multiple users will get different DISPLAYs.)

Attachment: PGP.sig
Description: This is a digitally signed message part

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSTask, environment and ... X11 (From: Thierry Passeron <email@hidden>)

  • Prev by Date: Re: A quick memory (release) question
  • Next by Date: Re: Cocoa-dev Digest, Vol 3, Issue 151
  • Previous by thread: Re: NSTask, environment and ... X11
  • Next by thread: Undo not showing change in NSBrowser with mapped children key path
  • Index(es):
    • Date
    • Thread