File: test_pipe_popen.rb

package info (click to toggle)
ruby-kgio 2.11.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 504 kB
  • sloc: ruby: 2,779; ansic: 2,017; sh: 32; makefile: 5
file content (14 lines) | stat: -rw-r--r-- 325 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'test/unit'
require 'io/nonblock'
$-w = true
require 'kgio'

class TestPipePopen < Test::Unit::TestCase
  def test_popen
    io = Kgio::Pipe.popen("sleep 1 && echo HI")
    assert_equal :wait_readable, io.kgio_tryread(2)
    sleep 1.5
    assert_equal "HI\n", io.kgio_read(3)
    assert_nil io.kgio_read(5)
  end
end