I'm trying to create a Mac app, which should return an error code in some cases. This is an Intel bundle. (It's a Carbon C++ project, but this is probably irrelevant.) The standard way to do it in C++ would be to have the main function return the value, and that's what I do, so I think that part is correct. (I also tried explicitly calling exit(42)) The question is: how do I get at this value? When I launch the app from the terminal with "open myapp", the return value is always 0, even if I always return a different number. (checked using echo $?) Is this the return value from the open command and is my app's return value being swallowed somewhere? I also always get a 0 return code if I launch it from another program using execve (which is how the app is designated to be used). Is it possible to retrieve a return code from an app? Thanks!
Sidenote: I need the program to be in a bundle.