On Wed, Aug 07, 2024 at 07:23:34PM +0200, Claudio Fontana wrote: > For the -l and -L options (logging mode), replace the use of the > KeyboardInterrupt exception to gracefully terminate in favor > of handling the SIGINT and SIGTERM signals. > > This allows the program to be run from scripts and still be > signaled to gracefully terminate without an interactive terminal. > > Before this change, something like this script: > > kvm_stat -p 85896 -d -t -s 1 -c -L kvm_stat_85896.csv & > sleep 10 > pkill -TERM -P $$ > > would yield an empty log: > -rw-r--r-- 1 root root 0 Aug 7 16:17 kvm_stat_85896.csv > > after this commit: > -rw-r--r-- 1 root root 13466 Aug 7 16:57 kvm_stat_85896.csv > > Signed-off-by: Claudio Fontana <cfontana@xxxxxxx> > Cc: Dario Faggioli <dfaggioli@xxxxxxxx> > Cc: Fabiano Rosas <farosas@xxxxxxx> > --- > tools/kvm/kvm_stat/kvm_stat | 64 ++++++++++++++++----------------- > tools/kvm/kvm_stat/kvm_stat.txt | 12 +++++++ > 2 files changed, 44 insertions(+), 32 deletions(-) Reviewed-by: Stefan Hajnoczi <stefanha@xxxxxxxxxx>
Attachment:
signature.asc
Description: PGP signature