Skip to content
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

Merged
merged 1 commit into from
Jul 30, 2016

Conversation

CyberShadow
Copy link
Collaborator

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.

@CyberShadow CyberShadow force-pushed the pull-20160709-071754 branch 2 times, most recently from ddd921b to 858a176 Compare July 9, 2016 09:56
@un1versal
Copy link
Contributor

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 :)

@un1versal
Copy link
Contributor

un1versal commented Jul 11, 2016

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

@CyberShadow
Copy link
Collaborator Author

Not sure, depends on how KVIrc is closed. It's likely a separate issue.

@un1versal
Copy link
Contributor

Ide like to merge this asap, so please can we have some feedback?


struct sigaction sa;

sa.sa_handler = KviSignalHandler::unixSignalHandler;
Copy link
Member

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, will do.

Copy link
Contributor

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.
@CyberShadow
Copy link
Collaborator Author

Fixed whitespace and rebased.

@staticfox staticfox merged commit 3ebbee9 into kvirc:master Jul 30, 2016
@un1versal
Copy link
Contributor

un1versal commented Jul 30, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants