execute 0.1.73 → 0.1.74

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
- SHA1:
3
- metadata.gz: 55471a7bdfc605188b00b9398701e5eb7930ba5a
4
- data.tar.gz: 65572161753f59536c950cb281ca4eadf5e7d7ec
2
+ SHA256:
3
+ metadata.gz: 415398c777d701eab63aa93d8c3fcb4c1a87772d5f36d0a71262d9e0783dca1c
4
+ data.tar.gz: 00bf23d3e60a0febfd975435878d8588271625b5afc32a8f8467b76e0fb89992
5
5
  SHA512:
6
- metadata.gz: e5dea0908aca1cf83e27a7442cf869ab40e2ed906eec4a7a55c291e742e3c7b68d0e687a46a0698e45099b590d0499176f75c5f0c07356bf482769c57628a3e6
7
- data.tar.gz: 2158ac84626394f6a3d7d94bab3dc39335243a499a9bde908fcea1bc4628cfd6a3a486fec2ba2498057fb28d7c7758285019ab01c3dc7a4e628b8e32fda16ef1
6
+ metadata.gz: 508f53e25ca258cbf484a4039240655a76f5290fca6b27bceb510d2ebf8a67c9d2c534a579ff00ca6cff93bb96ffb559c349c7c1216a5b07cecf32f9e860fc3c
7
+ data.tar.gz: 1ed7eae2a5d70494c9b987cf09e4dda635bf3e72534efafb4e1720ea004c2d1a1ac103eda1b7261addcd6501c9ead6d0e68203d62b72df9ed2540b43c7f3dfdb
@@ -206,9 +206,9 @@ def [](key)
206
206
  processes = get_child_processes(self[:pid])
207
207
 
208
208
  Process.kill(self[:timeout_signal], self[:pid])
209
- Process.waitpid(self[:pid]) unless(Sys::ProcTable.ps(self[:pid]).nil?)
209
+ Process.waitpid(pid: self[:pid]) unless(Sys::ProcTable.ps(pid: self[:pid]).nil?)
210
210
 
211
- processes.each { |p| Process.kill(self[:timeout_signal],p.pid) unless(Sys::ProcTable.ps(p.pid).nil?) }
211
+ processes.each { |p| Process.kill(self[:timeout_signal],p.pid) unless(Sys::ProcTable.ps(pid: p.pid).nil?) }
212
212
  end
213
213
 
214
214
  def get_child_processes(pid)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: execute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.73
4
+ version: 0.1.74
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Marshall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-16 00:00:00.000000000 Z
11
+ date: 2019-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,16 +72,16 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.9.8
75
+ version: 1.2.1
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.9.8
82
+ version: 1.2.1
83
83
  description: Class wrapper for system commands
84
- email: KCCKSMarshall@gmail.com
84
+ email: kevin@kware.us
85
85
  executables: []
86
86
  extensions: []
87
87
  extra_rdoc_files: []
@@ -89,7 +89,6 @@ files:
89
89
  - LICENSE
90
90
  - README.md
91
91
  - lib/execute.rb
92
- - lib/execute_windows.rb
93
92
  homepage: http://rubygems.org/gems/execute
94
93
  licenses:
95
94
  - Apache 2.0
@@ -109,8 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
108
  - !ruby/object:Gem::Version
110
109
  version: '0'
111
110
  requirements: []
112
- rubyforge_project:
113
- rubygems_version: 2.5.2
111
+ rubygems_version: 3.0.1
114
112
  signing_key:
115
113
  specification_version: 4
116
114
  summary: Class wrapper for system commands
@@ -1,44 +0,0 @@
1
- require 'open3'
2
- require 'sys/proctable'
3
- require_relative 'execute'
4
-
5
- class Execute < Hash
6
- def execute_as(username)
7
- self[:command] = "runas /noprofile /savecred /user:#{username} \"#{self[:command]}\""
8
- wait_on_spawned_process(self) { self.execute }
9
- end
10
-
11
- private
12
- def wait_on_spawned_process(cmd)
13
- yield
14
- post_execute = Sys::ProcTable.ps
15
-
16
- child_processes = []
17
- post_execute.each { |ps| child_processes << ps.pid if(ps.include?(cmd[:pid])) }
18
-
19
- trap("INT") do
20
- child_processes.each do |pid|
21
- s = Sys::ProcTable.ps(pid)
22
- begin
23
- if(!s.nil?)
24
- out_rd,out_wr = IO.pipe
25
- err_rd,err_wr = IO.pipe
26
- system("taskkill /pid #{pid}", :out => out_wr, :err => err_wr)
27
- end
28
- rescue => e
29
- end
30
- end
31
- exit
32
- end
33
-
34
- loop do
35
- all_exited = true
36
- child_processes.each do |pid|
37
- s = Sys::ProcTable.ps(pid)
38
- all_exited = false unless(s.nil?)
39
- end
40
- break if(all_exited)
41
- sleep(0.2)
42
- end
43
- end
44
- end