This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 9816fce3 kill(sig,-pid) fails with EINVAL
9816fce3 is described below

commit 9816fce32442125ddeead6e742cf57beff4b3430
Author: Sebb <[email protected]>
AuthorDate: Tue Nov 21 15:23:16 2023 +0000

    kill(sig,-pid) fails with EINVAL
---
 tools/site-scan.rb | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/tools/site-scan.rb b/tools/site-scan.rb
index 1d25590d..71f12361 100755
--- a/tools/site-scan.rb
+++ b/tools/site-scan.rb
@@ -223,14 +223,18 @@ def exec_with_timeout(cmd, timeout)
     puts "WARN: timeout scanning #{cmd[-1]} #{pid}"
     $stderr.puts "WARN:  #{Time.now} timeout scanning #{cmd[-1]} #{pid}"
     stderr = 'Timeout'
+    ret=''
     begin
-      # try using less drastic kill first (on process group)
-      Process.kill(-2, -pid) # INT
-      $stderr.puts "WARN:  #{Time.now} sent kill -2 #{-pid}"
-      Process.kill(-15, -pid) # TERM
-      $stderr.puts "WARN:  #{Time.now} sent kill -15 #{-pid}"
+      # kill -pid responds with EINVAL - invalid argument
+      $stderr.puts "WARN:  #{Time.now} about to kill -2 #{pid}"
+      ret = Process.kill(-2, pid) # INT
+      $stderr.puts "WARN:  #{Time.now} sent kill -2 #{pid} ret=#{ret}"
+
+      $stderr.puts "WARN:  #{Time.now} about to kill -15 #{pid}"
+      ret = Process.kill(-15, pid) # TERM
+      $stderr.puts "WARN:  #{Time.now} sent kill -15 #{pid} ret=#{ret}"
     rescue StandardError => e
-      $stderr.puts "WARN:  #{Time.now} exception #{e}"
+      $stderr.puts "WARN:  #{Time.now} ret=#{ret} exception: #{e}"
     end
     Process.detach(pid)
   ensure

Reply via email to