assassin 0.4.2 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +4 -2
- data/Rakefile +3 -3
- data/assassin.gemspec +2 -2
- data/lib/assassin.rb +5 -1
- metadata +8 -11
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c14afebd3564e3c079c80f1445167928d4a1279cea686da956aa894faab65a61
|
4
|
+
data.tar.gz: 48a24766c01cbbf85194c3e12ec620fd67ad2593dcab0fe574a56d29ec474b3e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fe4f99234544d6d6ff7ff11560eddf55f60ed8c701e1375db3103b9c3293f73315e24fe1336c1f0353f5dbd44fc75f979b3788dc234d92b59a3d95e66bb457e6
|
7
|
+
data.tar.gz: be550ca294f81f77bad88285fa5f56a15697a44689b340c16dc79883ca110722a263fdaea01ddc59dbd242a74c015b5b58a845fa7e0a768e40b7c1f1e4741dbd
|
data/README.md
CHANGED
@@ -8,9 +8,11 @@ SYNOPSIS
|
|
8
8
|
|
9
9
|
USAGE
|
10
10
|
-----
|
11
|
-
|
11
|
+
```ruby
|
12
|
+
pipe = IO.popen 'some-program-that-must-not-be-zombied'
|
12
13
|
|
13
14
|
Assassin.at_exit_kill(pipe.pid)
|
15
|
+
```
|
14
16
|
|
15
17
|
also see lib/assassin.rb and test/assassin_test.rb
|
16
18
|
|
@@ -27,7 +29,7 @@ DESCRIPTION
|
|
27
29
|
|
28
30
|
this becomes espcially important for libraries which spawn processes, such
|
29
31
|
as via `IO.popen` that need to ensure those children are cleaned up, but
|
30
|
-
which cannot control whether client code may call `exit
|
32
|
+
which cannot control whether client code may call `exit!`. this approach
|
31
33
|
also handles being `kill -9`d - something no `at_exit{}` handler can
|
32
34
|
promise.
|
33
35
|
|
data/Rakefile
CHANGED
@@ -4,7 +4,7 @@ This.email = "ara.t.howard@gmail.com"
|
|
4
4
|
This.homepage = "https://github.com/ahoward/#{ This.lib }"
|
5
5
|
|
6
6
|
task :license do
|
7
|
-
open('LICENSE', 'w'){|fd| fd.puts "
|
7
|
+
open('LICENSE', 'w'){|fd| fd.puts "Ruby"}
|
8
8
|
end
|
9
9
|
|
10
10
|
task :default do
|
@@ -93,7 +93,7 @@ task :gemspec do
|
|
93
93
|
test_files = "test/#{ lib }.rb" if File.file?("test/#{ lib }.rb")
|
94
94
|
summary = object.respond_to?(:summary) ? object.summary : "summary: #{ lib } kicks the ass"
|
95
95
|
description = object.respond_to?(:description) ? object.description : "description: #{ lib } kicks the ass"
|
96
|
-
license = object.respond_to?(:license) ? object.license : "
|
96
|
+
license = object.respond_to?(:license) ? object.license : "Ruby"
|
97
97
|
|
98
98
|
if This.extensions.nil?
|
99
99
|
This.extensions = []
|
@@ -297,7 +297,7 @@ BEGIN {
|
|
297
297
|
|
298
298
|
# discover full path to this ruby executable
|
299
299
|
#
|
300
|
-
c =
|
300
|
+
c = RbConfig::CONFIG
|
301
301
|
bindir = c["bindir"] || c['BINDIR']
|
302
302
|
ruby_install_name = c['ruby_install_name'] || c['RUBY_INSTALL_NAME'] || 'ruby'
|
303
303
|
ruby_ext = c['EXEEXT'] || ''
|
data/assassin.gemspec
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "assassin"
|
6
|
-
spec.version = "
|
6
|
+
spec.version = "1.4.2"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "assassin"
|
9
9
|
spec.description = "no zombies ever, not even on `exit!` or `kill -9`"
|
10
|
-
spec.license = "
|
10
|
+
spec.license = "Ruby"
|
11
11
|
|
12
12
|
spec.files =
|
13
13
|
["LICENSE",
|
data/lib/assassin.rb
CHANGED
@@ -2,7 +2,7 @@ require 'tmpdir'
|
|
2
2
|
require 'securerandom'
|
3
3
|
|
4
4
|
class Assassin
|
5
|
-
Version = '
|
5
|
+
Version = '1.4.2' unless defined?(Version)
|
6
6
|
|
7
7
|
def Assassin.version
|
8
8
|
Version
|
@@ -46,6 +46,7 @@ class Assassin
|
|
46
46
|
|
47
47
|
def Assassin.script_for(child_pid, options = {})
|
48
48
|
parent_pid = Process.pid
|
49
|
+
delay = (options[:delay] || 0.42).to_f
|
49
50
|
|
50
51
|
script = <<-__
|
51
52
|
Process.daemon
|
@@ -55,6 +56,7 @@ class Assassin
|
|
55
56
|
|
56
57
|
parent_pid = #{ parent_pid }
|
57
58
|
child_pid = #{ child_pid }
|
59
|
+
delay = #{ delay }
|
58
60
|
|
59
61
|
m = 24*60*60
|
60
62
|
n = 42
|
@@ -63,6 +65,8 @@ class Assassin
|
|
63
65
|
begin
|
64
66
|
Process.kill(0, parent_pid)
|
65
67
|
rescue Object => e
|
68
|
+
sleep(delay)
|
69
|
+
|
66
70
|
if e.is_a?(Errno::ESRCH)
|
67
71
|
n.times do
|
68
72
|
begin
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assassin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 1.4.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ara T. Howard
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2019-05-14 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: no zombies ever, not even on `exit!` or `kill -9`
|
15
14
|
email: ara.t.howard@gmail.com
|
@@ -28,28 +27,26 @@ files:
|
|
28
27
|
- test/parent.rb
|
29
28
|
homepage: https://github.com/ahoward/assassin
|
30
29
|
licenses:
|
31
|
-
-
|
30
|
+
- Ruby
|
31
|
+
metadata: {}
|
32
32
|
post_install_message:
|
33
33
|
rdoc_options: []
|
34
34
|
require_paths:
|
35
35
|
- lib
|
36
36
|
required_ruby_version: !ruby/object:Gem::Requirement
|
37
|
-
none: false
|
38
37
|
requirements:
|
39
|
-
- -
|
38
|
+
- - ">="
|
40
39
|
- !ruby/object:Gem::Version
|
41
40
|
version: '0'
|
42
41
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
42
|
requirements:
|
45
|
-
- -
|
43
|
+
- - ">="
|
46
44
|
- !ruby/object:Gem::Version
|
47
45
|
version: '0'
|
48
46
|
requirements: []
|
49
47
|
rubyforge_project: codeforpeople
|
50
|
-
rubygems_version:
|
48
|
+
rubygems_version: 2.7.6
|
51
49
|
signing_key:
|
52
|
-
specification_version:
|
50
|
+
specification_version: 4
|
53
51
|
summary: assassin
|
54
52
|
test_files: []
|
55
|
-
has_rdoc:
|