Re: [PATCH] tools/kvm_stat: fix termination behavior when not on a terminal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux