When run as service: Leaves ruby running and temp directory in place
On Windows Server 2008, if the ocra-generated EXE file is started as a service using SRVANY.EXE, when the service is stopped/killed, the ruby.exe/rubyw.exe continues running.
Killing the ruby.exe/rubyw.exe does not automatically clear the temporary directory hierarchy.
Is this a SRVANY.EXE problem or an OCRA problem?
Lets call it an OCRA deficiency. It can be handled by OCRA. I'll look into it.
I appears that Windows provide no method to trap kill signals. I only know only one way:
- Implement a service stub as alternative to the default main stub, which is based on the Windows' service API. Then the executable can be registered as a service on its own and will be notified of stop requests.
It probably possible to make the default stub slightly more robust by creating a message-only window and handling the WM_CLOSE message. However, this will still not help when running from SRVANY.EXE, nor when being terminated from the Process Explorer. WM_CLOSE appears to be the "official" method for terminating a process while giving it a chance to clean up, even for applications without windows (except services of course).