• 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: Launch a background task
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Launch a background task


  • Subject: Re: Launch a background task
  • From: Andy Lee <email@hidden>
  • Date: Sun, 2 Jun 2002 16:38:36 -0400

At 9:29 PM +0200 6/2/02, Arthur VIGAN wrote:
- (void)runScript
{
NSTask *scriptTask = [[NSTask alloc] init];

[sciptTask setLaunchPath:@"~/bin/myScript"];
[scriptTask launch];
}

The above works fine for me after correcting "sciptTask" to "scriptTask" and making a trivial bash script called ~/bin/myScript.

But I got the following error (ScriptMenu is the name of my app):

2002-06-02 21:26:11.491 ScriptMenu[2243] Task create for path
/Users/arthur/bin/myScript failed.

What should I do?

To be absolutely sure it's not the script itself, try replacing the body of the script with a trivial operation like 'ls' (keeping the #! line, of course) and see if your app works then.

At 9:56 PM +0200 6/2/02, Arthur VIGAN wrote:
It doesn't work even if I put the full path in the code.

Note: the script work fine from the terminal, so the error doesn't come from
the script.

There are slight differences between running it from the terminal and running it from your app -- for example, the working directory, which may or may not make a difference to your particular script. There may be slight differences in the environment as well.

If your script is not too hairy (or proprietary) maybe you could post it here in case somebody can spot something. Maybe your script starts a process that there can only be one instance of, and you forgot to kill it before testing with your app? It seems like there must be some problem about what the script is trying to do rather than how you are using NSTask.

--Andy
_______________________________________________
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.

References: 
 >Launch a background task (From: Arthur VIGAN <email@hidden>)

  • Prev by Date: Re: Launch a background task
  • Next by Date: CFXML problems
  • Previous by thread: Re: Launch a background task
  • Next by thread: Re: Launch a background task
  • Index(es):
    • Date
    • Thread