Skip to content

Commit

Permalink
Merge pull request #382 from nobu/leaked_pipes
Browse files Browse the repository at this point in the history
Close working pipes
  • Loading branch information
nobu committed Oct 12, 2021
2 parents 5dad328 + ac519f5 commit 30e589b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/reline/test_reline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,19 @@ def test_set_input_and_output
assert_raise(TypeError) do
Reline.output = "This is not a file."
end
Reline.input, to_write = IO.pipe
to_read, Reline.output = IO.pipe
input, to_write = IO.pipe
to_read, output = IO.pipe
Reline.input, Reline.output = input, output
to_write.write "a\n"
result = Reline.readline
to_write.close
read_text = to_read.read_nonblock(100)
assert_equal('a', result)
refute(read_text.empty?)
ensure
input&.close
output&.close
to_read&.close
end

def test_vi_editing_mode
Expand Down

0 comments on commit 30e589b

Please sign in to comment.