Hello.
I've been messing with wxwidgets off and on for several years now. I really like the documention and the samples and can almost always figure things out from them. But....
Anyways on to my problem: Does wx have any way to catch sigterm and create an event. I know under MSW and likely Mac there is a session end event that fires, but searching around, it looks like it doesn't work for Linux. Those threads are older so maybe this got added since then?
So if wxwidgets has no built in way of doing this, what would be the best way to implement this? All it needs to do is create a simple text file before shutdown. I know it's fairly simple to do as described here https://www.google.com/amp/s/airtower.w ... fully/amp/ but how to integrate it into wx?
Thanks.
mill-j
Catch an Event when app receives sigterm. Topic is solved
Re: Catch an Event when app receives sigterm.
Hi,
You seem to have almost answered your own question: do something similar to that link. To see it working in a wx program, CodeLite, have a look at CodeLiteApp::OnInit in app.cpp; it's currently at line 276.
Once in the handler function (WaitForDebugger() in this case) you can do more or less what you like. Untested, but I don't see why that shouldn't include creating a text file.
Regards,
David
You seem to have almost answered your own question: do something similar to that link. To see it working in a wx program, CodeLite, have a look at CodeLiteApp::OnInit in app.cpp; it's currently at line 276.
Once in the handler function (WaitForDebugger() in this case) you can do more or less what you like. Untested, but I don't see why that shouldn't include creating a text file.
Regards,
David
Re: Catch an Event when app receives sigterm.
You are correct. I missed this sentence
I dropped it into a minimal sample and it works perfect. I can clean stuff up like I need, including my single instance checker.
Thanks for the links, it's always good to see a working example.
Had I studied the code a little better, I would have seen that too.My Link wrote:This means that term() will be called when the program receives a SIGTERM.
I dropped it into a minimal sample and it works perfect. I can clean stuff up like I need, including my single instance checker.
Thanks for the links, it's always good to see a working example.