expectr 0.8.4 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/Gemfile +1 -1
  2. data/VERSION +1 -1
  3. data/expectr.gemspec +5 -5
  4. data/lib/expectr.rb +12 -4
  5. metadata +14 -14
data/Gemfile CHANGED
@@ -6,8 +6,8 @@ source "http://rubygems.org"
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
8
  group :development do
9
+ gem "bundler", ">= 1.0.0"
9
10
  gem "shoulda", ">= 0"
10
11
  gem "rdoc", "~> 3.12"
11
- gem "bundler", "~> 1.0.0"
12
12
  gem "jeweler", "~> 1.8.3"
13
13
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.4
1
+ 0.9.0
data/expectr.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "expectr"
8
- s.version = "0.8.4"
8
+ s.version = "0.9.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Chris Wuest"]
12
- s.date = "2012-05-11"
12
+ s.date = "2012-06-11"
13
13
  s.description = "Implementation of functionality from NIST Expect in Ruby, with an emphasis on control and extensibility"
14
14
  s.email = "chris@chriswuest.com"
15
15
  s.extra_rdoc_files = [
@@ -38,20 +38,20 @@ Gem::Specification.new do |s|
38
38
  s.specification_version = 3
39
39
 
40
40
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
41
+ s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
41
42
  s.add_development_dependency(%q<shoulda>, [">= 0"])
42
43
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
43
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
44
44
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
45
45
  else
46
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
46
47
  s.add_dependency(%q<shoulda>, [">= 0"])
47
48
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
48
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
49
49
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
50
50
  end
51
51
  else
52
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
52
53
  s.add_dependency(%q<shoulda>, [">= 0"])
53
54
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
54
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
55
55
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
56
56
  end
57
57
  end
data/lib/expectr.rb CHANGED
@@ -147,7 +147,6 @@ class Expectr
147
147
  begin
148
148
  @stdout.sysread(@buffer_size, buf)
149
149
  rescue Errno::EIO #Application went away.
150
- Process.wait @pid
151
150
  @pid = 0
152
151
  break
153
152
  end
@@ -162,6 +161,11 @@ class Expectr
162
161
  end
163
162
  end
164
163
  end
164
+
165
+ Thread.new do
166
+ Process.wait @pid
167
+ @pid = 0
168
+ end
165
169
  end
166
170
 
167
171
  #
@@ -188,7 +192,7 @@ class Expectr
188
192
  #
189
193
  def interact
190
194
  oldtrap = trap 'INT' do
191
- @stdin.syswrite "\C-c"
195
+ send "\C-c"
192
196
  end
193
197
 
194
198
  @flush_buffer = true
@@ -199,7 +203,7 @@ class Expectr
199
203
  input = ''
200
204
  while @pid > 0
201
205
  if select([STDIN], nil, nil, 1)
202
- @stdin.syswrite STDIN.getc.chr
206
+ send STDIN.getc.chr
203
207
  end
204
208
  end
205
209
  end
@@ -214,8 +218,12 @@ class Expectr
214
218
  # Send +str+ to application
215
219
  #
216
220
  def send(str)
221
+ begin
222
+ @stdin.syswrite str
223
+ rescue Errno::EIO #Application went away.
224
+ @pid = 0
225
+ end
217
226
  raise ArgumentError unless @pid > 0
218
- @stdin.syswrite str
219
227
  end
220
228
 
221
229
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expectr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,16 +9,16 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-11 00:00:00.000000000 Z
12
+ date: 2012-06-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: shoulda
15
+ name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 1.0.0
22
22
  type: :development
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,31 +26,31 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 1.0.0
30
30
  - !ruby/object:Gem::Dependency
31
- name: rdoc
31
+ name: shoulda
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ~>
35
+ - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: '3.12'
37
+ version: '0'
38
38
  type: :development
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ~>
43
+ - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: '3.12'
45
+ version: '0'
46
46
  - !ruby/object:Gem::Dependency
47
- name: bundler
47
+ name: rdoc
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: 1.0.0
53
+ version: '3.12'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 1.0.0
61
+ version: '3.12'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: jeweler
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -109,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  segments:
111
111
  - 0
112
- hash: -2545022963494714035
112
+ hash: 3612453504837545327
113
113
  required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements: