1. Re: crash feature request
- Posted by Juergen Luethje <j.lue at gmx.de> Apr 18, 2007
- 475 views
Robert Craig wrote: > Juergen Luethje wrote: > > Maybe I've found a workaround. I used crash_routine(), and the first > > command of my function for handling fatal run-time errors is > > }}} <eucode> > > free_console() > > </eucode> {{{ > > > > This seems to work fine on Windows 98 and XP, with an interpreted > > program as well as one compiled with Borland. I did not even see a black > > console window popping up temporarily -- or maybe my old eyes are just > > too slow? > > On XP, I tried to reproduce your result using: > > }}} <eucode> > include dll.e > include machine.e > > function bad() > free_console() > return 0 > end function > > crash_routine(routine_id("bad")) > > ? 1/0 > </eucode> {{{ > > With exw or exwc, I don't see any error traceback on the screen, > but I still get a console window that just says: > > Press Enter... > > and I have to hit the Enter key to make the console go away. > Did you do something that's different from the above? Ooops ... I'm sorry. Since I want my program to return an exit status code to the operating system it also uses abort(), but previously I just didn't notice that abort() plays a role in this context. Please try this:
include dll.e include machine.e constant FATAL_ERROR = 3 -- exit status code without warning function bad() free_console() abort(FATAL_ERROR) return 0 end function crash_routine(routine_id("bad")) ? 1/0
Now I also tested this on a Virtual Machine (which is considerably slower than the real machine), and there I saw a console window popping up temporarily. Regards, Juergen