childprocess 0.2.7 → 0.2.8

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.
@@ -1,3 +1,3 @@
1
1
  module ChildProcess
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  end
@@ -256,23 +256,20 @@ module ChildProcess
256
256
  end
257
257
 
258
258
  def handle_for(fd_or_io)
259
- case fd_or_io
260
- when IO
259
+ if fd_or_io.kind_of?(IO) || fd_or_io.respond_to?(:fileno)
261
260
  handle = get_osfhandle(fd_or_io.fileno)
262
- when Fixnum
261
+ elsif fd_or_io.kind_of?(Fixnum)
263
262
  handle = get_osfhandle(fd_or_io)
264
- else
265
- if fd_or_io.respond_to?(:to_io)
266
- io = fd_or_io.to_io
267
-
268
- unless io.kind_of?(IO)
269
- raise TypeError, "expected #to_io to return an instance of IO"
270
- end
263
+ elsif fd_or_io.respond_to?(:to_io)
264
+ io = fd_or_io.to_io
271
265
 
272
- handle = get_osfhandle(io.fileno)
273
- else
274
- raise TypeError, "invalid type: #{fd_or_io.inspect}"
266
+ unless io.kind_of?(IO)
267
+ raise TypeError, "expected #to_io to return an instance of IO"
275
268
  end
269
+
270
+ handle = get_osfhandle(io.fileno)
271
+ else
272
+ raise TypeError, "invalid type: #{fd_or_io.inspect}"
276
273
  end
277
274
 
278
275
  if handle == INVALID_HANDLE_VALUE
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: childprocess
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 7
10
- version: 0.2.7
9
+ - 8
10
+ version: 0.2.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jari Bakken