• 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: mutli instances test (was Re: Multi-threaded)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mutli instances test (was Re: Multi-threaded)


  • Subject: Re: mutli instances test (was Re: Multi-threaded)
  • From: Christopher Nebel <email@hidden>
  • Date: Mon, 10 Nov 2003 11:22:16 -0800

On Nov 9, 2003, at 9:30 PM, Graff wrote:

This spawns two instances side by side in the Terminal:
~/Desktop/ClearComment.app &
~/Desktop/ClearComment.app &

This spawns one instance in AppleScript then waits for it to quit and spawns another:
do shell script "nohup ~/Desktop/ClearComment.app &"
do shell script "nohup ~/Desktop/ClearComment.app &"

It looks like the AppleScript environment can only have 1 shell going at a time. If you stuff multiple commands into that shell they run just fine, but if you try to get them to run commands sequentially they fail. ...

Here's Apple's details on the "do shell script command". Tons of good stuff in there but nothing that helps me to solve this particular problem.
<http://developer.apple.com/technotes/tn2002/tn2065.html>

You didn't read carefully enough. (Admittedly, the question is a bit misleadingly labeled for this problem.) See "I want to start a background server process; how do I make do shell script not wait until the command completes?" under "Other Concerns".

The problem is that just "&" isn't good enough to disconnect the process under "do shell script" -- it's still waiting for stdout and stderr to return end-of-file. Use the following incantation instead:

do shell script "command > file_path 2>&1 &

If you don't care about the output (which you don't in this case), use "/dev/null" for file_path. Incidentally, you'd have much the same problem using backquotes in Perl, though Perl only watches stdout, so you wouldn't need the "2>&1" part.


--Chris Nebel
AppleScript Engineering
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: mutli instances test (was Re: Multi-threaded)
      • From: Graff <email@hidden>
References: 
 >Re: Multi-threaded - thanks (From: "John C. Welch" <email@hidden>)
 >Re: Multi-threaded - thanks (From: Bill Briggs <email@hidden>)
 >Re: Multi-threaded - thanks (From: Shane Stanley <email@hidden>)
 >Re: Multi-threaded - thanks (From: Bill Briggs <email@hidden>)
 >Re: Multi-threaded - thanks (From: Christopher Nebel <email@hidden>)
 >mutli instances test (was Re: Multi-threaded) (From: "leo" <email@hidden>)
 >Re: mutli instances test (was Re: Multi-threaded) (From: Graff <email@hidden>)

  • Prev by Date: Re: Replace å-ä-ö whit applescript.
  • Next by Date: Force string to be UTF-8?
  • Previous by thread: Re: mutli instances test (was Re: Multi-threaded)
  • Next by thread: Re: mutli instances test (was Re: Multi-threaded)
  • Index(es):
    • Date
    • Thread