How to run an automator app which launches an X11 app via shell script multiple times

automatorcommand linex11

So I have an Applescript to launch xemacs, but I thought it would be nice to have something I could drop files onto (and have an app to choose from contextual menus in the "open with" submenu), so I tried making an Automator app.

I called the app "XEmacs Opener.app" and it works… once. But it will not launch new XEmacs windows (unless I just click the run button from automator itself) until the first one is closed.

I tried running the shell script with nohup, used the '&' to put it in the background, and called exit afterwards, but this does not solve the problem:

nohup /sw/bin/xemacs "$@" &
exit

Here's a screen-shot in case I didn't fully explain how it's set up:

enter image description here

I also tried calling xemacs without any arguments too. So how can I get this to open up multiple instances of xemacs – or is that not possible?

Best Answer

I figured it out. I just need to direct the output to /dev/null:

/sw/bin/xemacs "$@" &> /dev/null &

Easy peasy. The output was getting grabbed by the shell script. As soo as you redirect both standard out and standard error to /dev/null (i.e. oblivion), the rest of the workflow stops waiting and ends.