posix-spawn 0.3.1 → 0.3.2

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.
@@ -146,7 +146,6 @@ module POSIX
146
146
  # exceeds the amount specified by the max argument.
147
147
  def read_and_write(input, stdin, stdout, stderr, timeout=nil, max=nil)
148
148
  input ||= ''
149
- input.force_encoding('BINARY') if input.respond_to?(:force_encoding)
150
149
  max = nil if max && max <= 0
151
150
  out, err = '', ''
152
151
  offset = 0
@@ -155,6 +154,12 @@ module POSIX
155
154
  @runtime = 0.0
156
155
  start = Time.now
157
156
 
157
+ if input.respond_to?(:force_encoding)
158
+ orig_encoding = input.encoding
159
+ input = input.dup.force_encoding('BINARY')
160
+ [ out, err ].each{ |str| str.force_encoding('BINARY') }
161
+ end
162
+
158
163
  writers = [stdin]
159
164
  readers = [stdout, stderr]
160
165
  t = timeout
@@ -202,6 +207,11 @@ module POSIX
202
207
  end
203
208
  end
204
209
 
210
+ if orig_encoding
211
+ out.force_encoding(orig_encoding)
212
+ err.force_encoding(orig_encoding)
213
+ end
214
+
205
215
  [out, err]
206
216
  end
207
217
 
@@ -1,5 +1,5 @@
1
1
  module POSIX
2
2
  module Spawn
3
- VERSION = '0.3.1'
3
+ VERSION = '0.3.2'
4
4
  end
5
5
  end
@@ -112,5 +112,6 @@ class ChildTest < Test::Unit::TestCase
112
112
  p = Child.new('cat', :input => input)
113
113
  assert p.success?
114
114
  assert_equal input, p.out
115
+ assert_match input, p.out
115
116
  end
116
117
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posix-spawn
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 1
10
- version: 0.3.1
5
+ version: 0.3.2
11
6
  platform: ruby
12
7
  authors:
13
8
  - Ryan Tomayko
@@ -27,11 +22,6 @@ dependencies:
27
22
  requirements:
28
23
  - - "="
29
24
  - !ruby/object:Gem::Version
30
- hash: 15
31
- segments:
32
- - 0
33
- - 7
34
- - 6
35
25
  version: 0.7.6
36
26
  type: :development
37
27
  version_requirements: *id001
@@ -81,23 +71,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
71
  requirements:
82
72
  - - ">="
83
73
  - !ruby/object:Gem::Version
84
- hash: 3
85
- segments:
86
- - 0
87
74
  version: "0"
88
75
  required_rubygems_version: !ruby/object:Gem::Requirement
89
76
  none: false
90
77
  requirements:
91
78
  - - ">="
92
79
  - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
80
  version: "0"
97
81
  requirements: []
98
82
 
99
83
  rubyforge_project:
100
- rubygems_version: 1.4.2
84
+ rubygems_version: 1.5.2
101
85
  signing_key:
102
86
  specification_version: 3
103
87
  summary: posix_spawnp(2) for ruby