Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Doesn't Applescript Exit After Background Shell Job?

Tags:

applescript

I can created an (very) simple applescript app to run Firefox background & exit. (The reason is I have different profiles for work & home). My script is basically:

do shell script "/Applications/firefox.app/Contents/MacOS/firefox -no-remote -P 'Personal' &"

It works, but the script/app doesn't exit until I quit Firefox. How can I fix that?

like image 712
Bill Avatar asked Nov 21 '09 20:11

Bill


1 Answers

You need to redirect stdout and stderr somewhere. The do shell script command knows that the pipes it setup for the program's stdout and stderr are still open, so it waits for them to be closed.

do shell script "/Applications/firefox.app/Contents/MacOS/firefox -no-remote -P 'Personal' > /dev/null 2>&1 &"
like image 106
Chris Johnsen Avatar answered Nov 03 '22 17:11

Chris Johnsen