execute 0.1.40 → 0.1.41

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cmd.rb +11 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 061d92584632aa290c94c0b57161ad77951492ea
4
- data.tar.gz: b76a1c1fe4ec10e05679e78e94d6c3b8e89cb714
3
+ metadata.gz: c30db8fb48cd4920cf89143cd05fb1dabf9492dc
4
+ data.tar.gz: 019ce53d33e1c029f8c38fc64e721911700075ee
5
5
  SHA512:
6
- metadata.gz: 20a8bd82b602a3768b7a23e7a8527fca44b240ff5651071ed08839bf1760a64499fb4af2631582237a29856668e21ebc27d464393916bc3e5f6b037c6e8b48c8
7
- data.tar.gz: 978cc09e2b15a4315110742343cd3d1ab37e16eab5dfbeae704052d459ccecd7fcb1c467d36885db52b833cae933c34f4e769f99b3c4bc6c9f1803d8085304fe
6
+ metadata.gz: 1f07e3a9013f73b11a3601b496ac9cb6833ea8bf19aeb1d1931abb028475d72a931d1f30ab10ca798034a96316e13d7b32a876b2786b635b49487808df445a6f
7
+ data.tar.gz: 6c87d75e9a8373555d1d05377134a1ef1554e7de8f13bfc97ca571570f58cc5e000d9a3d726046e78c2822b8b0fd97e6fea6f96b75801f7eae233f6e1db6483b
data/lib/cmd.rb CHANGED
@@ -125,11 +125,20 @@ class CMD < Hash
125
125
  end
126
126
  end
127
127
  def interrupt
128
- process = []
129
- Sys::ProcTable.ps { |p| process << p if(p.ppid == self[:pid]) }
128
+ process = get_child_processes(self[:pid])
130
129
  Sys::ProcTable.ps { |p| process << p if(p.pid == self[:pid]) }
131
130
 
132
131
  process.each { |p| Process.kill(self[:timeout_signal],p.pid) unless(Sys::ProcTable.ps(p.pid).nil?) }
133
132
  Process.waitpid(self[:pid]) unless(Sys::ProcTable.ps(self[:pid]).nil?)
134
133
  end
134
+ def get_child_processes(pid)
135
+ processes = []
136
+ Sys::ProcTable.ps do |p|
137
+ if(p.ppid == pid)
138
+ get_child_processes(p.pid).each { |cp| processes << cp }
139
+ processes << p
140
+ end
141
+ end
142
+ return processes
143
+ end
135
144
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: execute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.40
4
+ version: 0.1.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Marshall