dool
                                
                                 dool copied to clipboard
                                
                                    dool copied to clipboard
                            
                            
                            
                        Add SIGINT/SIGTERM/SIGHUP/SIGBREAK handler to fix missing data issue in --output mode
ISSUE TYPE
- Bugfix pull-request
DSTAT VERSION
0.9.10
SUMMARY
Add a SIGINT and SIGTERM handler so the data still in the I/O buffer will be written out before exiting the program.
:+1:
An orthogonal way of doing this is to disable buffering on the file (which might not be efficient for high frequency stats gathering). which is the purpose of https://github.com/scottchiefbaker/dool/pull/12
@minghungchen I'd like to see SIGHUP signal being catched as well, what do you think ?
@msimonin Sure. SIGHUP in Linux and SIGBREAK in Windows can be caught now
Apologies... Github was not sending me alerts for issues and pull requests on this repo. I did not see this until just now.
Is this still relevant? I'm working through some backlog.
I just landed some code that dramatically improves --output and I think addresses this issue. Please check https://github.com/scottchiefbaker/dool/commit/82cf041ba30333da3b73af0d60ea055802ca5779 and let me know. There is a pre-release v1.2.0 available with this code in it.
I think I've already fixed most of the stuff related to --output but I want to implement signal handling in the future so this is a good start.
@minghungchen is it possible to use signal handling to not output the trailing "^C" on STDOUT if I press CTRL + C to terminate dool?
A simple trick is print out a few '\b' and then print something else to overwrite the existing contents, e.g., a few space to overwrite ^c. I did not test in dool but this trick usually works, but might need a flush at the end.
@minghungchen oh good call. I just landed eee27c5 which seems to work for covering up "^C"