Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Didn't try this but...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Didn't try this but...
Authored by: macavenger on Jan 20, '03 05:20:37PM

after some experimenting, it looks to me like the key part (to keep the script from hanging) is the '> /dev/null 2>&1 &' If you take this section out, it still works, but the script hangs. Put it back in, and the script exits cleanly. On a related note, the "set results to" section can be shortened to: set results to do shell script "open-x11 /path/to/gimp > /dev/null 2>&1 &"



[ Reply to This | # ]
Didn't try this but...
Authored by: Bernd P. Ziller on Jan 25, '03 08:17:10AM

As you found out, the key part is the redirection of stdout and stderr to /dev/null...

by this you fully detach the background job from shell. if you don't do this, the shell and your backgrounded command still share the same file-handles for stdout and stderr, which makes your script hang.

Sometimes you might even have to redirect stdin with '</dev/null'...

as in 'command >/dev/null 2>&1 </dev/null &'.



[ Reply to This | # ]