proc-wait3 1.7.1 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +8 -0
- data.tar.gz.sig +0 -0
- data/{CHANGES → CHANGES.md} +50 -19
- data/Gemfile +7 -0
- data/LICENSE +177 -0
- data/MANIFEST.md +18 -0
- data/README.md +53 -0
- data/Rakefile +18 -21
- data/certs/djberg96_pub.pem +26 -0
- data/doc/wait3.txt +2 -2
- data/ext/extconf.rb +13 -24
- data/ext/proc/wait3.c +20 -32
- data/lib/proc-wait3.rb +1 -0
- data/proc-wait3.gemspec +14 -6
- data/spec/proc_wait3_spec.rb +234 -0
- metadata +58 -26
- metadata.gz.sig +2 -0
- data/MANIFEST +0 -14
- data/README +0 -46
- data/test/test_proc_wait3.rb +0 -223
metadata
CHANGED
@@ -1,17 +1,44 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proc-wait3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
|
14
|
+
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
15
|
+
MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
|
16
|
+
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
17
|
+
bTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALgfa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AwH1G4ZPv69sQAFAOCgAqYmdnzedsQtE
|
33
|
+
1LQfaQrx0twO+CZJPcRLEESjq8ScQxWRRkfuh2VeR7cEU7L7KqT10mtUwrvw7APf
|
34
|
+
DYoeCY9KyjIBjQXfbj2ke5u1hZj94Fsq9FfbEQg8ygCgwThnmkTrrKEiMSs3alYR
|
35
|
+
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
36
|
+
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
date: 2021-01-07 00:00:00.000000000 Z
|
12
39
|
dependencies:
|
13
40
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
41
|
+
name: rake
|
15
42
|
requirement: !ruby/object:Gem::Requirement
|
16
43
|
requirements:
|
17
44
|
- - ">="
|
@@ -25,19 +52,19 @@ dependencies:
|
|
25
52
|
- !ruby/object:Gem::Version
|
26
53
|
version: '0'
|
27
54
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
55
|
+
name: rspec
|
29
56
|
requirement: !ruby/object:Gem::Requirement
|
30
57
|
requirements:
|
31
|
-
- - "
|
58
|
+
- - "~>"
|
32
59
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
60
|
+
version: '3.9'
|
34
61
|
type: :development
|
35
62
|
prerelease: false
|
36
63
|
version_requirements: !ruby/object:Gem::Requirement
|
37
64
|
requirements:
|
38
|
-
- - "
|
65
|
+
- - "~>"
|
39
66
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
67
|
+
version: '3.9'
|
41
68
|
description: |2
|
42
69
|
The proc-wait3 library adds the wait3, wait4, waitid, pause, sigsend,
|
43
70
|
and getrusage methods to the Process module.
|
@@ -45,16 +72,15 @@ email: djberg96@gmail.com
|
|
45
72
|
executables: []
|
46
73
|
extensions:
|
47
74
|
- ext/extconf.rb
|
48
|
-
extra_rdoc_files:
|
49
|
-
- CHANGES
|
50
|
-
- README
|
51
|
-
- MANIFEST
|
52
|
-
- ext/proc/wait3.c
|
75
|
+
extra_rdoc_files: []
|
53
76
|
files:
|
54
|
-
- CHANGES
|
55
|
-
-
|
56
|
-
-
|
77
|
+
- CHANGES.md
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE
|
80
|
+
- MANIFEST.md
|
81
|
+
- README.md
|
57
82
|
- Rakefile
|
83
|
+
- certs/djberg96_pub.pem
|
58
84
|
- doc/wait3.txt
|
59
85
|
- examples/example_getrusage.rb
|
60
86
|
- examples/example_pause.rb
|
@@ -63,13 +89,20 @@ files:
|
|
63
89
|
- examples/example_waitid.rb
|
64
90
|
- ext/extconf.rb
|
65
91
|
- ext/proc/wait3.c
|
92
|
+
- lib/proc-wait3.rb
|
66
93
|
- proc-wait3.gemspec
|
67
|
-
-
|
94
|
+
- spec/proc_wait3_spec.rb
|
68
95
|
homepage: https://github.com/djberg96/proc-wait3
|
69
96
|
licenses:
|
70
|
-
-
|
71
|
-
metadata:
|
72
|
-
|
97
|
+
- Apache-2.0
|
98
|
+
metadata:
|
99
|
+
homepage_uri: https://github.com/djberg96/proc-wait3
|
100
|
+
bug_tracker_uri: https://github.com/djberg96/proc-wait3/issues
|
101
|
+
changelog_uri: https://github.com/djberg96/proc-wait3/blob/master/CHANGES.md
|
102
|
+
documentation_uri: https://github.com/djberg96/proc-wait3/wiki
|
103
|
+
source_code_uri: https://github.com/djberg96/proc-wait3
|
104
|
+
wiki_uri: https://github.com/djberg96/proc-wait3/wiki
|
105
|
+
post_install_message:
|
73
106
|
rdoc_options: []
|
74
107
|
require_paths:
|
75
108
|
- lib
|
@@ -84,10 +117,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
117
|
- !ruby/object:Gem::Version
|
85
118
|
version: '0'
|
86
119
|
requirements: []
|
87
|
-
|
88
|
-
|
89
|
-
signing_key:
|
120
|
+
rubygems_version: 3.0.3
|
121
|
+
signing_key:
|
90
122
|
specification_version: 4
|
91
123
|
summary: Adds wait3, wait4 and other methods to the Process module
|
92
124
|
test_files:
|
93
|
-
-
|
125
|
+
- spec/proc_wait3_spec.rb
|
metadata.gz.sig
ADDED
data/MANIFEST
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
CHANGES
|
2
|
-
MANIFEST
|
3
|
-
Rakefile
|
4
|
-
README
|
5
|
-
proc-wait3.gemspec
|
6
|
-
doc/wait3.txt
|
7
|
-
ext/extconf.rb
|
8
|
-
ext/proc/wait3.c
|
9
|
-
examples/example_getrusage.rb
|
10
|
-
examples/example_pause.rb
|
11
|
-
examples/example_wait3.rb
|
12
|
-
examples/example_wait4.rb
|
13
|
-
examples/example_waitid.rb
|
14
|
-
test/test_proc_wait3.rb
|
data/README
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
= Description
|
2
|
-
Adds the wait3, wait4, waitid, pause, sigsend, and getrusage methods to
|
3
|
-
the Process module.
|
4
|
-
|
5
|
-
= Installation
|
6
|
-
gem install proc-wait3
|
7
|
-
|
8
|
-
= Synopsis
|
9
|
-
require 'proc/wait3'
|
10
|
-
|
11
|
-
pid = fork{
|
12
|
-
sleep 1
|
13
|
-
exit 2
|
14
|
-
}
|
15
|
-
|
16
|
-
puts Time.now.to_s
|
17
|
-
Process.wait3
|
18
|
-
puts $?.exitstatus # => 2
|
19
|
-
|
20
|
-
= Tested Platforms
|
21
|
-
* Solaris
|
22
|
-
* Linux
|
23
|
-
* FreeBSD
|
24
|
-
* OS X
|
25
|
-
|
26
|
-
= Warnings
|
27
|
-
Linux users who compile with gcc -Wall will notice a few warnings. These
|
28
|
-
are harmless (and unavoidable atm).
|
29
|
-
|
30
|
-
= Integration with Ruby's process.c
|
31
|
-
|
32
|
-
I considered simply providing a patch to the core process.c file, but I
|
33
|
-
decided against it for two reasons. First, I wanted to get something
|
34
|
-
out more quickly rather than waiting for approval from the core developers
|
35
|
-
who, based on an earlier post, seem somewhat gun-shy about integrating support
|
36
|
-
for wait3() and wait4() based, I think, on portability concerns.
|
37
|
-
|
38
|
-
Second, and more importantly, I don't like the cProcStatus class. The
|
39
|
-
extra inspection code seems like an awful lot of work for very little gain.
|
40
|
-
The overloaded methods are also overkill, and do nothing but save me the
|
41
|
-
trouble of typing the word "status", since all they're for is comparing or
|
42
|
-
operating on the status attribute.
|
43
|
-
|
44
|
-
= Additional Documentation
|
45
|
-
|
46
|
-
Please see the doc/wait3.txt file for detailed documentation.
|
data/test/test_proc_wait3.rb
DELETED
@@ -1,223 +0,0 @@
|
|
1
|
-
##################################################################
|
2
|
-
# test_proc_wait3.rb
|
3
|
-
#
|
4
|
-
# Test suite for the Ruby proc-wait3 package. You should run this
|
5
|
-
# via the 'test' rake task.
|
6
|
-
##################################################################
|
7
|
-
require 'proc/wait3'
|
8
|
-
require 'test-unit'
|
9
|
-
require 'rbconfig'
|
10
|
-
|
11
|
-
class TC_Proc_Wait3 < Test::Unit::TestCase
|
12
|
-
def self.startup
|
13
|
-
@@solaris = RbConfig::CONFIG['host_os'] =~ /sunos|solaris/i
|
14
|
-
@@darwin = RbConfig::CONFIG['host_os'] =~ /darwin|osx/i
|
15
|
-
@@hpux = RbConfig::CONFIG['host_os'] =~ /hpux/i
|
16
|
-
@@linux = RbConfig::CONFIG['host_os'] =~ /linux/i
|
17
|
-
@@freebsd = RbConfig::CONFIG['host_os'] =~ /bsd/i
|
18
|
-
end
|
19
|
-
|
20
|
-
def setup
|
21
|
-
@proc_stat = nil
|
22
|
-
@proc_stat_members = [
|
23
|
-
"pid", "status", "utime", "stime", "maxrss",
|
24
|
-
"ixrss", "idrss", "isrss", "minflt", "majflt", "nswap", "inblock",
|
25
|
-
"oublock", "msgsnd", "msgrcv", "nsignals", "nvcsw", "nivcsw",
|
26
|
-
"stopped", "signaled","exited","success","coredump","exitstatus",
|
27
|
-
"termsig", "stopsig"
|
28
|
-
]
|
29
|
-
|
30
|
-
if RUBY_VERSION.to_f >= 1.9
|
31
|
-
@proc_stat_members = @proc_stat_members.map{ |e| e.to_sym }
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
test "version constant is set to expected value" do
|
36
|
-
assert_equal('1.7.1', Process::WAIT3_VERSION)
|
37
|
-
end
|
38
|
-
|
39
|
-
test "wait3 method is defined" do
|
40
|
-
assert_respond_to(Process, :wait3)
|
41
|
-
end
|
42
|
-
|
43
|
-
test "wait3 works as expected" do
|
44
|
-
fork{ sleep 0.5 }
|
45
|
-
assert_nothing_raised{ Process.wait3 }
|
46
|
-
end
|
47
|
-
|
48
|
-
test "wait3 returns the expected proc status membes" do
|
49
|
-
fork{ sleep 0.5 }
|
50
|
-
assert_nothing_raised{ @proc_stat = Process.wait3 }
|
51
|
-
assert_equal(@proc_stat_members, @proc_stat.members)
|
52
|
-
end
|
53
|
-
|
54
|
-
test "wait3 with WNOHANG works as expected" do
|
55
|
-
fork{ sleep 0.5 }
|
56
|
-
assert_nothing_raised{ Process.wait3(Process::WNOHANG) }
|
57
|
-
end
|
58
|
-
|
59
|
-
test "wait3 sets and returns $last_status to expected values" do
|
60
|
-
fork{ sleep 0.5 }
|
61
|
-
Process.wait3
|
62
|
-
assert_kind_of(Struct::ProcStat, $last_status)
|
63
|
-
assert_not_nil($last_status)
|
64
|
-
end
|
65
|
-
|
66
|
-
test "wait3 sets pid and status members of $?" do
|
67
|
-
fork{ sleep 0.5 }
|
68
|
-
Process.wait3
|
69
|
-
assert_not_nil($?)
|
70
|
-
end
|
71
|
-
|
72
|
-
test "wait3 returns frozen struct" do
|
73
|
-
fork{ sleep 0.5 }
|
74
|
-
struct = Process.wait3
|
75
|
-
assert_true(struct.frozen?)
|
76
|
-
end
|
77
|
-
|
78
|
-
test "getdtablesize works as expected" do
|
79
|
-
omit_unless(@@solaris, 'getdtablesize skipped on this platform')
|
80
|
-
|
81
|
-
assert_respond_to(Process, :getdtablesize)
|
82
|
-
assert_kind_of(Fixnum, Process.getdtablesize)
|
83
|
-
assert(Process.getdtablesize > 0)
|
84
|
-
end
|
85
|
-
|
86
|
-
test "wait4 method is defined" do
|
87
|
-
omit_if(@@hpux, 'wait4 test skipped on this platform')
|
88
|
-
assert_respond_to(Process,:wait4)
|
89
|
-
end
|
90
|
-
|
91
|
-
test "wait4 requires at least one argument" do
|
92
|
-
assert_raises(ArgumentError){ Process.wait4 }
|
93
|
-
end
|
94
|
-
|
95
|
-
test "wait4 works as expected" do
|
96
|
-
omit_if(@@hpux, 'wait4 test skipped on this platform')
|
97
|
-
|
98
|
-
pid = fork{ sleep 0.5 }
|
99
|
-
assert_nothing_raised{ @proc_stat = Process.wait4(pid) }
|
100
|
-
assert_kind_of(Struct::ProcStat, @proc_stat)
|
101
|
-
end
|
102
|
-
|
103
|
-
test "wait4 sets and returns $last_status to expected values" do
|
104
|
-
pid = fork{ sleep 0.5 }
|
105
|
-
Process.wait4(pid)
|
106
|
-
assert_kind_of(Struct::ProcStat, $last_status)
|
107
|
-
assert_not_nil($last_status)
|
108
|
-
end
|
109
|
-
|
110
|
-
test "wait4 sets pid and status members of $?" do
|
111
|
-
pid = fork{ sleep 0.5 }
|
112
|
-
Process.wait4(pid)
|
113
|
-
assert_not_nil($?)
|
114
|
-
end
|
115
|
-
|
116
|
-
test "wait4 returns frozen struct" do
|
117
|
-
pid = fork{ sleep 0.5 }
|
118
|
-
struct = Process.wait4(pid)
|
119
|
-
assert_true(struct.frozen?)
|
120
|
-
end
|
121
|
-
|
122
|
-
test "waitid method is defined" do
|
123
|
-
omit_if(@@hpux || @@darwin || @@freebsd, 'waitid test skipped on this platform')
|
124
|
-
assert_respond_to(Process, :waitid)
|
125
|
-
end
|
126
|
-
|
127
|
-
test "waitid method works as expected" do
|
128
|
-
omit_if(@@hpux || @@darwin || @@freebsd, 'waitid test skipped on this platform')
|
129
|
-
pid = fork{ sleep 0.5 }
|
130
|
-
assert_nothing_raised{ Process.waitid(Process::P_PID, pid, Process::WEXITED) }
|
131
|
-
end
|
132
|
-
|
133
|
-
test "waitid method raises expected errors if wrong argument type is passed" do
|
134
|
-
omit_if(@@hpux || @@darwin || @@freebsd, 'waitid test skipped on this platform')
|
135
|
-
pid = fork{ sleep 0.5 }
|
136
|
-
assert_raises(TypeError){ Process.waitid("foo", pid, Process::WEXITED) }
|
137
|
-
assert_raises(TypeError){ Process.waitid(Process::P_PID, pid, "foo") }
|
138
|
-
assert_raises(TypeError){ Process.waitid(Process::P_PID, "foo", Process::WEXITED) }
|
139
|
-
end
|
140
|
-
|
141
|
-
test "waitid method raises expected error if invalid argument is passed" do
|
142
|
-
omit_if(@@hpux || @@darwin || @@freebsd, 'waitid test skipped on this platform')
|
143
|
-
fork{ sleep 0.5 }
|
144
|
-
assert_raises(Errno::ECHILD, Errno::EINVAL){ Process.waitid(Process::P_PID, 99999999, Process::WEXITED) }
|
145
|
-
end
|
146
|
-
|
147
|
-
test "sigsend method is defined" do
|
148
|
-
omit_unless(@@solaris, 'sigsend test skipped on this platform')
|
149
|
-
assert_respond_to(Process, :sigsend)
|
150
|
-
end
|
151
|
-
|
152
|
-
test "sigsend works as expected" do
|
153
|
-
omit_unless(@@solaris, 'sigsend test skipped on this platform')
|
154
|
-
pid = fork{ sleep 0.5 }
|
155
|
-
assert_nothing_raised{ Process.sigsend(Process::P_PID, pid, 0) }
|
156
|
-
end
|
157
|
-
|
158
|
-
test "getrusage method is defined" do
|
159
|
-
assert_respond_to(Process, :getrusage)
|
160
|
-
end
|
161
|
-
|
162
|
-
test "getrusage works as expected" do
|
163
|
-
fork{ sleep 0.5 }
|
164
|
-
assert_nothing_raised{ Process.getrusage }
|
165
|
-
assert_nothing_raised{ Process.getrusage(true) }
|
166
|
-
end
|
167
|
-
|
168
|
-
test "getrusage returns the expected struct" do
|
169
|
-
fork{ sleep 0.5 }
|
170
|
-
assert_kind_of(Struct::RUsage, Process.getrusage)
|
171
|
-
assert_kind_of(Float, Process.getrusage.stime)
|
172
|
-
assert_kind_of(Float, Process.getrusage.utime)
|
173
|
-
end
|
174
|
-
|
175
|
-
test "pause method is defined" do
|
176
|
-
assert_respond_to(Process, :pause)
|
177
|
-
end
|
178
|
-
|
179
|
-
test "expected constants are defined" do
|
180
|
-
omit_if(@@darwin || @@freebsd, 'wait constant check skipped on this platform')
|
181
|
-
|
182
|
-
assert_not_nil(Process::WCONTINUED)
|
183
|
-
assert_not_nil(Process::WEXITED)
|
184
|
-
assert_not_nil(Process::WNOWAIT)
|
185
|
-
assert_not_nil(Process::WSTOPPED)
|
186
|
-
|
187
|
-
omit_if(@@linux, 'WTRAPPED constant check skipped on this platform')
|
188
|
-
assert_not_nil(Process::WTRAPPED)
|
189
|
-
end
|
190
|
-
|
191
|
-
test "expected process type flag constants are defined" do
|
192
|
-
omit_if(@@linux || @@darwin || @@freebsd, 'process type flag check skipped on this platform')
|
193
|
-
|
194
|
-
assert_not_nil(Process::P_ALL)
|
195
|
-
assert_not_nil(Process::P_CID)
|
196
|
-
assert_not_nil(Process::P_GID)
|
197
|
-
assert_not_nil(Process::P_MYID) unless @@solaris
|
198
|
-
assert_not_nil(Process::P_PGID)
|
199
|
-
assert_not_nil(Process::P_PID)
|
200
|
-
assert_not_nil(Process::P_SID)
|
201
|
-
assert_not_nil(Process::P_UID)
|
202
|
-
end
|
203
|
-
|
204
|
-
test "solaris-specific process type flags are defined on solaris" do
|
205
|
-
omit_unless(@@solaris, 'P_TASKID and P_PROJID constant check skipped on this platform')
|
206
|
-
|
207
|
-
assert_not_nil(Process::P_TASKID)
|
208
|
-
assert_not_nil(Process::P_PROJID)
|
209
|
-
end
|
210
|
-
|
211
|
-
def teardown
|
212
|
-
@proc_stat = nil
|
213
|
-
@proc_stat_members = nil
|
214
|
-
end
|
215
|
-
|
216
|
-
def self.shutdown
|
217
|
-
@@solaris = nil
|
218
|
-
@@darwin = nil
|
219
|
-
@@hpux = nil
|
220
|
-
@@linux = nil
|
221
|
-
@@freebsd = nil
|
222
|
-
end
|
223
|
-
end
|