ztk 1.4.20 → 1.4.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,26 +21,19 @@ module ZTK
21
21
  #
22
22
  # @return [Object] Returns the $? object.
23
23
  def spawn(*args, &block)
24
- reader, writer, pid = nil
25
-
26
24
  begin
27
- if block_given?
28
- ::PTY.spawn(*args) do |reader, writer, pid|
29
- begin
30
- yield(reader, writer, pid)
31
- rescue Errno::EIO
32
- ensure
33
- ::Process.wait(pid)
34
- end
25
+ ::PTY.spawn(*args) do |reader, writer, pid|
26
+ begin
27
+ block_given? and yield(reader, writer, pid)
28
+ rescue Errno::EIO
29
+ ensure
30
+ ::Process.wait(pid)
35
31
  end
36
- else
37
- raise "You must supply a block!"
38
- # reader, writer, pid = ::PTY.spawn(*args)
39
32
  end
40
33
  rescue ::PTY::ChildExited
41
34
  end
42
35
 
43
- [reader, writer, pid]
36
+ true
44
37
  end
45
38
 
46
39
  end
@@ -1,6 +1,6 @@
1
1
  module ZTK
2
2
 
3
3
  # ZTK Version String
4
- VERSION = "1.4.20"
4
+ VERSION = "1.4.21"
5
5
 
6
6
  end
@@ -35,16 +35,16 @@ describe ZTK::PTY do
35
35
  describe "behaviour" do
36
36
 
37
37
  it "should spawn a command with a block" do
38
- lambda do
38
+ lambda {
39
39
  subject.spawn("hostname") do |r, w, p|
40
40
  end
41
- end.should_not raise_error
41
+ }.should_not raise_error
42
42
  end
43
43
 
44
- it "should not spawn a command without a block" do
44
+ it "should spawn a command without a block" do
45
45
  lambda {
46
46
  r, w, p = subject.spawn("hostname")
47
- }.should raise_error
47
+ }.should_not raise_error
48
48
  end
49
49
 
50
50
  describe "spawn" do
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.20
4
+ version: 1.4.21
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-23 00:00:00.000000000 Z
12
+ date: 2013-06-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: erubis
@@ -265,7 +265,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
265
265
  version: '0'
266
266
  segments:
267
267
  - 0
268
- hash: 1623916729135851728
268
+ hash: -1023917271579459839
269
269
  required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  none: false
271
271
  requirements:
@@ -274,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
274
  version: '0'
275
275
  segments:
276
276
  - 0
277
- hash: 1623916729135851728
277
+ hash: -1023917271579459839
278
278
  requirements: []
279
279
  rubyforge_project:
280
280
  rubygems_version: 1.8.25