Background:
Ruby script is packaged into an executable using OCRA 1.2.
Script is structured as follows:
begin
<some code that runs for a while>
ensure
<cleanup code>
end
Problem:
When I run the executable on Windows, it opens a console window and works as usual. If I manage to press Ctrl-C, the cleanup code will be launched. But if I have to close the console window, the cleanup code will not run.
In any case, to make sure the cleanup code will run, even in this scenario?
Side note: I'm from a Java background, using Ruby for the first time.
source
share