• 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
Using Terminal within Cocoa App.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using Terminal within Cocoa App.


  • Subject: Using Terminal within Cocoa App.
  • From: Caroline <email@hidden>
  • Date: Wed, 16 Jan 2008 17:25:04 +0900
  • Importance: normal

Hello world,

I want to run some App by using Terminal script.
My Cocoa App can run Terminal by using NSTask as follow.

NSTask *task = [[NSTask alloc] init];
NSPipe *pipe = [NSPipe pipe];

[task setStandardOutput:newPipe];
[task setLaunchPath:@"/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal"];
[task setArguments:[NSArray arrayWithObjects:[NSString stringWithFormat:@"cd %@", someApp_Path],nil]];
[task launch];

I expect to set Terminal command "cd Path..." (ex. cd /Users/Desktop/...), and excute the someApp,
but there is no event.

How can I develop my Cocoa App to set automatically Terminal command, and someApp executes?
Is it impossible?
_______________________________________________

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

  • Follow-Ups:
    • Re: Using Terminal within Cocoa App.
      • From: Andrew Farmer <email@hidden>
  • Prev by Date: Re: Quitting Current Application
  • Next by Date: Re: Using Terminal within Cocoa App.
  • Previous by thread: Re: NSLock and AutoreleasePool question
  • Next by thread: Re: Using Terminal within Cocoa App.
  • Index(es):
    • Date
    • Thread