[Openmcl-devel] :error-handler argument to save-application doesn't seem to work on windows

Ron Garret ron at flownet.com
Tue Jan 7 17:43:06 PST 2014


On Jan 7, 2014, at 1:01 PM, Gary Byers <gb at clozure.com> wrote:

> It's not clear to me why you think thar changing what happens when an unhandled
> error occurs should affect what happens when BREAK is called.

TL;DR: I didn’t think it through.

Long version, if you really want to know: I was putting the final touches on a standalone Windows application (originally developed on a Mac) that needs to be somewhat secure against user meddling.  I had been running the application by invoking the executable from git-bash.  When you do that, ctrl-C does not call break, it quits the application.  I am not normally a Windows developer, so I assumed that this behavior was a Windows-ism, and that ctrl-C would result in the application quitting no matter how it was invoked.  So it was a nasty surprise to me when I discovered that I was wrong, and that ctrl-C produces a break loop when the executable is invoked by double-clicking on its icon.  Needless to say, this would be a bit of a security hole.  In that somewhat panicked and not-completely-thinking-things-through frame of mind, something like the following thought flitted through my brain (as best I can reconstruct it now): OK, I have to prevent the standalone application from entering break loops.  I can’t be the only person who wants to produce a standalone executable that can’t be mucked with by the user, so save-application must have an option that allows me to produce such an application (because the folks at Clozure are really good, and 9 times out of 10 when I need CCL to do something it turns out that it already does it).  Ah, here’s an option that prevents Lisp from entering break loops on unhandled errors.  That seems like the right thing, except that ctrl-C is not exactly an unhandled error.  Oh well, let’s try it anyway.  Maybe ctrl-C is translated into a Lisp condition in some way that I don’t know about (hey, all kinds of weird shit happens on Windows), or maybe the documentation doesn’t really mean what it says.  Or something.  It only takes 10 seconds to rebuild the app and try it so there’s little to lose…

(Ten seconds later)

Bummer, that didn’t work.  I’m out of ideas, let’s see if anyone on openmcl-devel knows how to do this…

And indeed, someone does:

> You can change the handling of ^C in a Windows console application by doing
> 
> ? (#_SetConsoleCtrlHandler (%null-ptr) #$FALSE)

Thanks!

rg




More information about the Openmcl-devel mailing list