ztk 1.4.22 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/ztk/command.rb +10 -14
  2. data/lib/ztk/version.rb +1 -1
  3. data/ztk.gemspec +2 -1
  4. metadata +24 -8
data/lib/ztk/command.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'ostruct'
2
2
  require 'timeout'
3
+ require 'childprocess'
3
4
 
4
5
  module ZTK
5
6
 
@@ -46,6 +47,8 @@ module ZTK
46
47
  :silence => false
47
48
  }.merge(configuration))
48
49
  config.ui.logger.debug { "config=#{config.send(:table).inspect}" }
50
+
51
+ ChildProcess.posix_spawn = false
49
52
  end
50
53
 
51
54
  # Execute Command
@@ -94,19 +97,11 @@ module ZTK
94
97
 
95
98
  start_time = Time.now.utc
96
99
 
97
- pid = Process.fork do
98
- parent_stdout_reader.close
99
- parent_stderr_reader.close
100
-
101
- STDOUT.reopen(child_stdout_writer)
102
- STDERR.reopen(child_stderr_writer)
103
- STDIN.reopen("/dev/null")
104
-
105
- child_stdout_writer.close
106
- child_stderr_writer.close
100
+ proc = ChildProcess.build(*command)
101
+ proc.io.stdout = child_stdout_writer
102
+ proc.io.stderr = child_stderr_writer
103
+ proc.start
107
104
 
108
- Kernel.exec(command)
109
- end
110
105
  child_stdout_writer.close
111
106
  child_stderr_writer.close
112
107
 
@@ -153,10 +148,11 @@ module ZTK
153
148
  rescue Timeout::Error => e
154
149
  direct_log(:fatal) { log_header("TIMEOUT") }
155
150
  log_and_raise(CommandError, "Process timed out after #{options.timeout} seconds!")
151
+ proc.stop
156
152
  end
157
153
 
158
- Process.waitpid(pid)
159
- exit_code = $?.exitstatus
154
+ proc.wait
155
+ exit_code = proc.exit_code
160
156
  direct_log(:info) { log_header("STOPPED") }
161
157
 
162
158
  parent_stdout_reader.close
data/lib/ztk/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module ZTK
2
2
 
3
3
  # ZTK Version String
4
- VERSION = "1.4.22"
4
+ VERSION = "1.5.0"
5
5
 
6
6
  end
data/ztk.gemspec CHANGED
@@ -36,10 +36,11 @@ Gem::Specification.new do |spec|
36
36
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
37
37
  spec.require_paths = ["lib"]
38
38
 
39
+ spec.add_dependency("activesupport")
40
+ spec.add_dependency("childprocess", "0.3.6")
39
41
  spec.add_dependency("erubis")
40
42
  spec.add_dependency("net-ssh")
41
43
  spec.add_dependency("net-sftp")
42
- spec.add_dependency("activesupport")
43
44
 
44
45
  spec.add_development_dependency("pry")
45
46
  spec.add_development_dependency("rake")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ztk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.22
4
+ version: 1.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,10 +9,10 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-05 00:00:00.000000000 Z
12
+ date: 2013-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: erubis
15
+ name: activesupport
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
@@ -28,7 +28,23 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
30
  - !ruby/object:Gem::Dependency
31
- name: net-ssh
31
+ name: childprocess
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - '='
36
+ - !ruby/object:Gem::Version
37
+ version: 0.3.6
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - '='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.3.6
46
+ - !ruby/object:Gem::Dependency
47
+ name: erubis
32
48
  requirement: !ruby/object:Gem::Requirement
33
49
  none: false
34
50
  requirements:
@@ -44,7 +60,7 @@ dependencies:
44
60
  - !ruby/object:Gem::Version
45
61
  version: '0'
46
62
  - !ruby/object:Gem::Dependency
47
- name: net-sftp
63
+ name: net-ssh
48
64
  requirement: !ruby/object:Gem::Requirement
49
65
  none: false
50
66
  requirements:
@@ -60,7 +76,7 @@ dependencies:
60
76
  - !ruby/object:Gem::Version
61
77
  version: '0'
62
78
  - !ruby/object:Gem::Dependency
63
- name: activesupport
79
+ name: net-sftp
64
80
  requirement: !ruby/object:Gem::Requirement
65
81
  none: false
66
82
  requirements:
@@ -265,7 +281,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
265
281
  version: '0'
266
282
  segments:
267
283
  - 0
268
- hash: -3810276298240369576
284
+ hash: -3936130905649481277
269
285
  required_rubygems_version: !ruby/object:Gem::Requirement
270
286
  none: false
271
287
  requirements:
@@ -274,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
290
  version: '0'
275
291
  segments:
276
292
  - 0
277
- hash: -3810276298240369576
293
+ hash: -3936130905649481277
278
294
  requirements: []
279
295
  rubyforge_project:
280
296
  rubygems_version: 1.8.25