sys-proctable 1.2.5 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01c653a363b9c37b67d34370e882e24aefc772c95677ee7420b9601f279c2e9b
4
- data.tar.gz: c3dbf4252b810a0abd69bdc3d401a653ae8b8e24d31d8be15fea7d5ddd37f7a3
3
+ metadata.gz: 67e97600844b87fee76e66de7ca9ce8dc437c4b0e37d8760a1a1211629ca0ad4
4
+ data.tar.gz: 8f3940b17936f4fa4fdcbaae499728d54a0d20160f320021882435dc42fa8e1d
5
5
  SHA512:
6
- metadata.gz: 9f97e3368e08424eb1ac80dd50865f0803066de539fd93defebfb8dbd8591d44447a24a5621555b2b6e29f5f72ae33f03be2b973d3106ad87ecd1bcef67fb8eb
7
- data.tar.gz: a17fd29c3cfc2aed02ab884467aa24f403258aa8bc9f4f9fa084892685d6898992808625e3dacc18d1616232f11ad8c2b7ac8ce21b80fdd3bd8faadb4e733791
6
+ metadata.gz: 7d9abfefc12b38b3e9961aaed71e4c0cf220418d6e719e945bcb72fe0d66a9782375ad860bb9f9dd37cedb5aefa410d689cdc97cfeb8ecc9f61e9c6eecf6fcf1
7
+ data.tar.gz: b1bb3b2a1fad203879b6a3c79066e730c074e9b6a5c090da0abdaebe86e4648dbccf07955c27e575ea52aa0c38acc08ae781754ee68dc50c8527f7c054433c56
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,12 @@
1
+ == 1.2.6 - 25-Aug-2020
2
+ * Made some updates so that it worked properly with TruffleRuby on Mac.
3
+ * Fixed an issue on Linux where non-ascii environ strings could cause failure.
4
+ Thanks go to deemytch for the spot and original patch.
5
+ * Removed the spec_helper.rb file, just use Process.spawn instead of messing
6
+ around with custom fork implementations. This also helps with implementations
7
+ that don't support fork.
8
+ * Updated the MANIFEST.
9
+
1
10
  == 1.2.5 - 19-Jun-2020
2
11
  * Added the delayacct_blkio_ticks, guest_time, and cguest_time fields on Linux.
3
12
  These require 2.6.18 or later, but will simply be nil on earlier versions.
@@ -8,6 +8,8 @@
8
8
  * benchmarks/bench_ips_ps.rb
9
9
  * example/example_ps.rb
10
10
  * lib/sys-proctable.rb
11
+ * lib/sys-top.rb
12
+ * lib/sys/proctable.rb
11
13
  * lib/sys/top.rb
12
14
  * lib/sys/proctable/version.rb
13
15
  * lib/aix/sys/proctable.rb
@@ -16,11 +18,11 @@
16
18
  * lib/linux/sys/proctable.rb
17
19
  * lib/sunos/sys/proctable.rb
18
20
  * lib/windows/sys/proctable.rb
19
- * test/test_sys_proctable_aix.rb
20
- * test/test_sys_proctable_all.rb
21
- * test/test_sys_proctable_darwin.rb
22
- * test/test_sys_proctable_freebsd.rb
23
- * test/test_sys_proctable_linux.rb
24
- * test/test_sys_proctable_sunos.rb
25
- * test/test_sys_proctable_windows.rb
26
- * test/test_sys_top.rb
21
+ * spec/sys_proctable_aix_spec.rb
22
+ * spec/sys_proctable_all_spec.rb
23
+ * spec/sys_proctable_darwin_spec.rb
24
+ * spec/sys_proctable_freebsd_spec.rb
25
+ * spec/sys_proctable_linux_spec.rb
26
+ * spec/sys_proctable_sunos_spec.rb
27
+ * spec/sys_proctable_windows_spec.rb
28
+ * spec/sys_top_spec.rb
data/Rakefile CHANGED
@@ -51,7 +51,7 @@ end
51
51
 
52
52
  desc 'Run the test suite for the sys-proctable library'
53
53
  RSpec::Core::RakeTask.new(:spec) do |t|
54
- t.pattern = ['spec/spec_helper.rb', 'spec/sys_proctable_all_spec.rb']
54
+ t.pattern = ['spec/sys_proctable_all_spec.rb']
55
55
 
56
56
  case CONFIG['host_os']
57
57
  when /aix/i
@@ -26,9 +26,13 @@ module Sys
26
26
  MAXTHREADNAMESIZE = 64
27
27
  PROC_PIDPATHINFO_MAXSIZE = MAXPATHLEN * 4
28
28
 
29
- # JRuby on Mac
29
+ # JRuby/Truffleruby on Mac
30
30
  unless defined? FFI::StructLayout::CharArray
31
- FFI::StructLayout::CharArray = FFI::StructLayout::CharArrayProxy
31
+ if defined? FFI::StructLayout::CharArrayProxy
32
+ FFI::StructLayout::CharArray = FFI::StructLayout::CharArrayProxy
33
+ else
34
+ FFI::StructLayout::CharArray = FFI::Struct::CharArray
35
+ end
32
36
  end
33
37
 
34
38
  class ProcBsdInfo < FFI::Struct
@@ -146,7 +146,7 @@ module Sys
146
146
  struct.environ = {}
147
147
 
148
148
  begin
149
- IO.read("/proc/#{file}/environ").split("\0").each{ |str|
149
+ IO.read("/proc/#{file}/environ").force_encoding("UTF-8").split("\0").each{ |str|
150
150
  key, value = str.split('=')
151
151
  struct.environ[key] = value
152
152
  }
@@ -1,6 +1,6 @@
1
1
  module Sys
2
2
  class ProcTable
3
3
  # The version of the sys-proctable library
4
- VERSION = '1.2.5'.freeze
4
+ VERSION = '1.2.6'.freeze
5
5
  end
6
6
  end
@@ -16,7 +16,7 @@ describe Sys::ProcTable do
16
16
  end
17
17
 
18
18
  it "has a VERSION constant set to the expected value" do
19
- expect(Sys::ProcTable::VERSION).to eql('1.2.5')
19
+ expect(Sys::ProcTable::VERSION).to eql('1.2.6')
20
20
  expect(Sys::ProcTable::VERSION).to be_frozen
21
21
  end
22
22
 
@@ -21,8 +21,8 @@ describe Sys::ProcTable do
21
21
  }
22
22
 
23
23
  before(:all) do
24
- @pid1 = fork { exec('env', '-i', 'A=B', 'Z=', 'sleep', '60') }
25
- @pid2 = fork { exec('ruby', '-Ilib', '-e', 'sleep \'120\'.to_i', '--', 'foo bar') }
24
+ @pid1 = Process.spawn({'A' => 'B', 'Z' => nil}, "sleep 60")
25
+ @pid2 = Process.spawn("ruby", "-Ilib", "-e", "sleep \'120\'.to_i", "--", "foo bar")
26
26
  sleep 1 # wait to make sure env is replaced by sleep
27
27
  end
28
28
 
@@ -38,7 +38,7 @@ describe Sys::ProcTable do
38
38
 
39
39
  it "returns the expected results for the fields method" do
40
40
  expect(described_class.fields).to be_kind_of(Array)
41
- expect(described_class.fields).to eql(fields)
41
+ expect(described_class.fields).to eq(fields)
42
42
  end
43
43
  end
44
44
 
@@ -48,72 +48,72 @@ describe Sys::ProcTable do
48
48
  it "contains a pid member and returns the expected value" do
49
49
  expect(subject).to respond_to(:pid)
50
50
  expect(subject.pid).to be_kind_of(Numeric)
51
- expect(subject.pid).to eql(@pid1)
51
+ expect(subject.pid).to eq(@pid1)
52
52
  end
53
53
 
54
54
  it "contains a ppid member and returns the expected value" do
55
55
  expect(subject).to respond_to(:ppid)
56
56
  expect(subject.ppid).to be_kind_of(Numeric)
57
- expect(subject.ppid).to eql(Process.pid)
57
+ expect(subject.ppid).to eq(Process.pid)
58
58
  end
59
59
 
60
60
  it "contains a pgid member and returns the expected value" do
61
61
  expect(subject).to respond_to(:pgid)
62
62
  expect(subject.pgid).to be_kind_of(Numeric)
63
- expect(subject.pgid).to eql(Process.getpgrp)
63
+ expect(subject.pgid).to eq(Process.getpgrp)
64
64
  end
65
65
 
66
66
  it "contains a ruid member and returns the expected value" do
67
67
  expect(subject).to respond_to(:ruid)
68
68
  expect(subject.ruid).to be_kind_of(Numeric)
69
- expect(subject.ruid).to eql(Process.uid)
69
+ expect(subject.ruid).to eq(Process.uid)
70
70
  end
71
71
 
72
72
  it "contains an rgid member and returns the expected value" do
73
73
  expect(subject).to respond_to(:rgid)
74
74
  expect(subject.rgid).to be_kind_of(Numeric)
75
- expect(subject.rgid).to eql(Process.gid)
75
+ expect(subject.rgid).to eq(Process.gid)
76
76
  end
77
77
 
78
78
  it "contains an svuid member and returns the expected value" do
79
79
  expect(subject).to respond_to(:svuid)
80
80
  expect(subject.svuid).to be_kind_of(Numeric)
81
- expect(subject.svuid).to eql(Process.uid)
81
+ expect(subject.svuid).to eq(Process.uid)
82
82
  end
83
83
 
84
84
  it "contains an svgid member and returns the expected value" do
85
85
  expect(subject).to respond_to(:svgid)
86
86
  expect(subject.svgid).to be_kind_of(Numeric)
87
- expect(subject.svgid).to eql(Process.gid)
87
+ expect(subject.svgid).to eq(Process.gid)
88
88
  end
89
89
 
90
- it "contains a comm member and returns the expected value", :skip_jruby do
90
+ it "contains a comm member and returns the expected value" do
91
91
  expect(subject).to respond_to(:comm)
92
92
  expect(subject.comm).to be_kind_of(String)
93
- expect(subject.comm).to eql('sleep')
93
+ expect(subject.comm).to eq('sleep')
94
94
  end
95
95
 
96
- it "contains a cmdline member and returns the expected value", :skip_jruby do
96
+ it "contains a cmdline member and returns the expected value" do
97
97
  expect(subject).to respond_to(:cmdline)
98
98
  expect(subject.cmdline).to be_kind_of(String)
99
- expect(subject.cmdline).to eql('sleep 60')
99
+ expect(subject.cmdline).to eq('sleep 60')
100
100
  end
101
101
 
102
- it "returns a string with the expected arguments for the cmdline member", :skip_jruby do
102
+ it "returns a string with the expected arguments for the cmdline member" do
103
103
  ptable = Sys::ProcTable.ps(pid: @pid2)
104
- expect(ptable.cmdline).to eql('ruby -Ilib -e sleep \'120\'.to_i -- foo bar')
104
+ expect(ptable.cmdline).to eq('ruby -Ilib -e sleep \'120\'.to_i -- foo bar')
105
105
  end
106
106
 
107
- it "contains an exe member and returns the expected value", :skip_jruby do
107
+ it "contains an exe member and returns the expected value" do
108
108
  expect(subject).to respond_to(:exe)
109
109
  expect(subject.exe).to be_kind_of(String)
110
- expect(subject.exe).to eql(`which sleep`.chomp)
110
+ expect(subject.exe).to eq(`which sleep`.chomp)
111
111
  end
112
112
 
113
- it "contains an environ member and returns the expected value", :skip_jruby do
113
+ it "contains an environ member and returns the expected value" do
114
114
  expect(subject).to respond_to(:environ)
115
115
  expect(subject.environ).to be_kind_of(Hash)
116
- expect(subject.environ['A']).to eql('B')
116
+ expect(subject.environ['A']).to eq('B')
117
117
  expect(subject.environ['Z']).to be_nil
118
118
  end
119
119
  end
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'sys-proctable'
5
- spec.version = '1.2.5'
5
+ spec.version = '1.2.6'
6
6
  spec.author = 'Daniel J. Berger'
7
7
  spec.license = 'Apache-2.0'
8
8
  spec.email = 'djberg96@gmail.com'
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sys-proctable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - |
@@ -35,7 +35,7 @@ cert_chain:
35
35
  ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
36
  WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
37
37
  -----END CERTIFICATE-----
38
- date:
38
+ date:
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: ffi
@@ -125,7 +125,7 @@ metadata:
125
125
  documentation_uri: https://github.com/djberg96/sys-proctable/wiki
126
126
  source_code_uri: https://github.com/djberg96/sys-proctable
127
127
  wiki_uri: https://github.com/djberg96/sys-proctable/wiki
128
- post_install_message:
128
+ post_install_message:
129
129
  rdoc_options: []
130
130
  require_paths:
131
131
  - lib
@@ -140,12 +140,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubygems_version: 3.0.6
144
- signing_key:
143
+ rubygems_version: 3.1.4
144
+ signing_key:
145
145
  specification_version: 4
146
146
  summary: An interface for providing process table information
147
147
  test_files:
148
- - spec/spec_helper.rb
149
148
  - spec/sys_proctable_aix_spec.rb
150
149
  - spec/sys_proctable_all_spec.rb
151
150
  - spec/sys_proctable_darwin_spec.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,22 +0,0 @@
1
- RSpec.configure do |config|
2
- config.filter_run_excluding :skip_jruby if RUBY_PLATFORM == 'java'
3
- end
4
-
5
- if RUBY_PLATFORM == 'java'
6
- require 'ffi'
7
- module Exec
8
- extend FFI::Library
9
- ffi_lib FFI::Library::LIBC
10
- attach_function :fork, [], :int
11
- end
12
-
13
- def fork
14
- pid = Exec.fork
15
- if pid == 0
16
- yield if block_given?
17
- return nil
18
- else
19
- return pid
20
- end
21
- end
22
- end