1 require File.dirname(__FILE__) + '/../../spec_helper'
5 @file = File.open(File.dirname(__FILE__) + '/fixtures/readlines.txt', 'r')
6 @io = IO.open @file.fileno, 'r'
10 # we *must* close both in order to not leak descriptors
11 @io.close unless @io.closed?
12 @file.close unless @file.closed? rescue Errno::EBADF
15 it "returns nil for IO not associated with a process" do
19 it "returns the ID of a process associated with stream" do
20 IO.popen(RUBY_NAME, "r+") { |io|
21 io.pid.should_not == nil
25 it "raises IOError on closed stream" do
26 process_io = IO.popen(RUBY_NAME, "r+") { |io| io }
27 lambda { process_io.pid }.should raise_error(IOError)