Friday 15 January 2010

objective c - Issue launching X11 app via NSTask -


Text after "

My application uses NSTask to execute shell scripts, launch one X11 application from those scripts (special >

Profile # setup $ path / etc together to become one

But it fails with:.

  gtk.icon_theme_get_default () append_search_path (meld.paths.icon_dir ()) Traceback (most recent last call): file "/ usr / local / bin / meld", line 132, & lt ; Module & gt; . Gtk.icon_theme_get_default () append_search_path (meld.paths.icon_dir ()) AttributeError: 'NoneType' object is not a property 'append_search_path'   

As a proof of the concept I do this The script for which is completely changed:

  # / usr / bin / dark red colored executive 'osascript -e' to say "terminal application" terminal "script front" Dir.pwd + 'Will Meet' To Do It! Window \ '\   

Is there a problem? Here's my code to execute a shell script:

  NSTask * task = [[NSTask alloc] init]; Task.launchPath = self.scriptURL.path; Work.standardOutput = [NSPipe pipe]; Task.currentDirectoryPath = Task Directory URL.path; [Launch the task];    

X11 applications DISPLAY learn the address of the display server using environment variables.

On OS X, the DISPLAY value is randomly remembered for security reasons, so you can not hard-code it, as you have seen. Instead, there is a launcher agent that launches projection to launch when it starts a process.

Somewhere between launch and mail, the price of DISPLAY has been deleted or overwritten. Your job is to find out where it is.

  1. Make sure the launch agent is running. Run launctl list and see org.macosforge.xquartz.startx. Since meld is working with terminal.app, this part is probably correct.
  2. Make sure that DISPLAY is set in your app, it should be listed in the [NSProcessInfo processInfo]. Environment .
  3. Make sure that you have a display set in the launch of NSTask, try running / usr / bin / env with NSTask, and make sure that DISPLAY appears in your output is.
  4. Make sure that DISPLAY is set inside the script you have run echo $ DISPLAY before and sourcing ~ / .profile (sometimes .profile is wrong to yourself Overwrites the value because it is sometimes the right thing to do this on other operating systems.)

    Edit: This code is a shell script Used to copy performance from my GUI app:

      NSTask * function = ... task.environment = [NSProcessInfo processInfo] .environment; [Task.launch];    

No comments:

Post a Comment