mstratman/cocoadialog — Issue #28: Exit status instead of a return value?
Author: markcarver
Created: 2011-10-24 23:46:56+00:00
State: open
Labels: 3.0, Discussion

@mstratman and @technocoreai,

Just thinking out loud here. Typically, the return value includes an "exit status" for an event such as a timeout or a button press as the first line. Shouldn't this really be returned as a true exit code?

Instead of using `[NSApp terminate:nil]`, shouldn't we use something like the following since this is a CLI?

int exitCode = 0;
if (returnTimedOut) {
exitCode = -4
}
else if (returnCanceled) {
exitCode = -1
}
else if (returnButton) {
exitCode = buttonPressed; // 1,2, or 3
}
exit(exitCode);

Only reason I'm asking because I don't know how other scripting languages would handle this. In bash, it would rather be better to implement it this way because bash can use the variable `$?` to return the exit code.

What, if any, would the ramifications be if this were to happen?