Application exit code

About Monkey 2 Forums Monkey 2 Programming Help Application exit code

This topic contains 3 replies, has 3 voices, and was last updated by  Arjailer 2 years, 10 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2622

    Arjailer
    Participant

    Is there a way to return an exit code from an application? Particularly a console app.

    The Process class has an ExitCode, but it looks like that’s for running and interacting with other processes.

    #2658

    degac
    Participant

    Hi

    In mojo, class App, method Terminate there is a call to libc.exit_(0)

    Maybe it’s possible to change the value hacking the methods.

    But to be honest I don’t know if the function writes something to the standard output, or what actually id does – I don’t really find myself in the MX2 source structure!

    edit:

    A possible solution (not tested) – intercepting the Event.WindowClose you could use Print “Something” before calling App.Terminate(). Of course in case of crash I suppose this can’t happen

    #2664

    Mark Sibly
    Keymaster

    Just use libc.exit_( whatever ) directly.

    #2665

    Arjailer
    Participant

    Thanks – I’ll give it a whirl  🙂

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.