-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shut down cleanly on SIGTERM and SIGINT #2055
Conversation
ddd921b
to
858a176
Compare
this is great work, logging engine has been neglected for ages, Im sure someone was moaning about this issue (lost few lines) on IRC or maybe its just wishful thinking so I have a plausible excuse for professing my admiration :) |
Would this also potentially improve lost settings on closing? reference #1744 it was asked on IRC last night so i thought I'de mention it (it happens randomly in Linux) since settings only writen to disk on shutdown |
Not sure, depends on how KVIrc is closed. It's likely a separate issue. |
Ide like to merge this asap, so please can we have some feedback? |
|
||
struct sigaction sa; | ||
|
||
sa.sa_handler = KviSignalHandler::unixSignalHandler; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May you cleanup the style to be more consistent? e.g. indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you do catch up after holidays and come to this bit, a nice touch would be a rebase against master when youre at it. ;)
so then can finally merge this.
SIGTERM is the standard way on POSIX for the OS to tell an application to close. It can be sent when the computer is shutting down or the user is logging off, as well as by the user, directly, or indirectly (e.g. by using a task manager). SIGINT is sent when the user presses Ctrl+C in a terminal window in which the program is running. In both of these cases, KVIrc should shut down cleanly, as if the user closed the main window. This implies flushing logs. By implementing SIGTERM and SIGINT handling on POSIX, this patch fixes the log files not being flushed on receiving such a signal, thus causing the last few lines to be lost.
858a176
to
3ebbee9
Compare
Fixed whitespace and rebased. |
Hi, Please find the latest report on new defect(s) introduced to kvirc/coverity found with Coverity Scan. 2 new defect(s) introduced to kvirc/coverity found with Coverity Scan. New defect(s) Reported-by: Coverity Scan Showing 2 of 2 defect(s) ** CID 138519: Uninitialized variables ** CID 138518: Error handling issues rest removed |
SIGTERM is the standard way on POSIX for the OS to tell an application
to close. It can be sent when the computer is shutting down or the user
is logging off, as well as by the user, directly, or indirectly (e.g. by
using a task manager).
SIGINT is sent when the user presses Ctrl+C in a terminal window in
which the program is running.
In both of these cases, KVIrc should shut down cleanly, as if the user
closed the main window. This implies flushing logs.
By implementing SIGTERM and SIGINT handling on POSIX, this patch fixes
the log files not being flushed on receiving such a signal, thus causing
the last few lines to be lost.