Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am launching an app from a script using:

open /path/to/foo.app -F -g -W --args -foo bar

When the application crashes (in particular, it seg faults), the window sits open forever and the app does not exit. However, when I launch the app the old fashioned way

/path/to/foo.app/Contents/MacOSX/foo -foo bar

it simply exits and returns a nonzero error code to the script, which is what I want. How can I get this behaviour (exit on seg fault and return an error code) using the "open" syntax above? The motivation is to get access to OSX-specific options such as -F, -g, -W etc.

share|improve this question

I would avoid using the -W option. From open's man page:

-W Causes open to wait until the applications it opens (or that were already open) have exited. Use with the -n flag to allow open to function as an appropriate app for the $EDITOR environment vari- able.

This could be your issue.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .