From 9ba0695652a57a95cf4b5f34497413c8dde9ce48 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Mon, 31 Oct 2022 11:25:21 +0100 Subject: [PATCH] Trap CTRL+C to exit all yes commands --- script/rspec-slow-repeat | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/script/rspec-slow-repeat b/script/rspec-slow-repeat index 081408f3f6..87588a568c 100755 --- a/script/rspec-slow-repeat +++ b/script/rspec-slow-repeat @@ -7,6 +7,14 @@ # You can use the resulting pass rate to asses if your code changes fixed it # or not. In the end I would run a spec 100 times to be sure it's stable. +function finish() { + echo "Exiting..." + killall yes + exit 0 +} + +trap finish SIGINT + if [ "$#" -lt 1 ]; then echo "Usage: $0 [rspec params]" echo "Example: $0 30 spec/system/admin/order_cycles/simple_spec.rb:202" @@ -44,7 +52,7 @@ for i in `seq "$n"`; do fi done -killall yes - pass_rate="$(( passed * 100 / n))" echo "$passed of $n passed ($pass_rate%)" + +finish