Re: mutli instances test (was Re: Multi-threaded)
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.