Question about "Quit(status)" in GUI application

I have a situation where I launch a bash script from a GUI desktop link. The bash script takes care of some basic housekeeping and setup and then launches my Xojo GUI application. When the Xojo GUI application terminates, I’d like to be able to check the bash status code to determine how the GUI app was terminated.

Apparently the “Quit(status)” command doesn’t work in the GUI environment. But Xojo will compile the Quit(status) command without complaining. Is there any possibility that the Xojo folks would consider allowing a GUI app to return a status to a Bash script? Or is there some technical reason why this can’t be done?

I suppose I can resort to leaving some sort of flag file behind that the Bash script can interrogate to see how my app was terminated but that seems like a less elegant method than just using the Bash status code.

Thanks,
-Wes

Perhaps you might be able to use StdOut

http://documentation.xojo.com/index.php/Quit
Clearly states For console applications only, the optional parameter returns a status code.
It has no effect in a GUI app - compiles but has no effect

A declare into EXIT MIGHT (huge MIGHT) work but lord knows what else it might foobar since its a very abrupt way to quit
@Joe Ranieri or @William Yu might know if this is even workable

But this would be just one “standard” way to do it. :wink:

[quote=351095:@Norman Palardy]http://documentation.xojo.com/index.php/Quit
Clearly states For console applications only, the optional parameter returns a status code.
It has no effect in a GUI app - compiles but has no effect

A declare into EXIT MIGHT (huge MIGHT) work but lord knows what else it might foobar since its a very abrupt way to quit
@Joe Ranieri or @William Yu might know if this is even workable[/quote]

Hi Norman, Is there some technical reason why Xojo GUI application can’t provide a status code? Given that you can launch a GUI application from a Bash script it seems like a useful thing to have.

I suppose it is one way to do it… And it may be the way I will have to do it. :frowning:

Using flag files just seems like a less elegant method than using a mechanism that Bash provides for exactly this type of situation.

But I didn’t think it would hurt to suggest to Xojo that they allow the Quit command to leave a status code when a GUI app quits. Unless there’s some technical reason that makes it unfeasible.

I just did a quick search and it looks like GTK supports returning a status code when a GUI app’s main loop ends. GTK is the GUI library that Xojo employs when building Linux GUI apps isn’t it?

@Joe Ranieri or @William Yu would know this

On macOS you could use exit():

[quote]Declare Sub exit_ Lib “libSystem.B.dylib” Alias “exit” (status As Integer)
exit_(3)
// Console / Terminal shows:
// 21.09.17 06:40:02,200 com.apple.xpc.launchd[1]: (com.test.myapp.872352[85574]) Service exited with abnormal code: 3[/quote]